-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support renaming files if the filename attributes were modified #304
base: main
Are you sure you want to change the base?
Conversation
5abacc2
to
95ea5c4
Compare
@jacebrowning if you think this is looking OK, I will add tests and docs. IMHO the changes for filename attributes to be immutable without |
@tbabej since I don't see anywhere an actual rename is performed, does that suggest that this feature already (implicitly) exists, aside from leaving the old filename around? If that's the case then perhaps a simpler "beta gate" would be add a new
What do you think? |
My apologies for not making this more clear in the commit messages, this MR actually currently fully implements the feature. The logic is as follows:
detects whether the file location has changed by invalidating the cache of the Lines 298 to 300 in c47ca62
on the line 298 the file content is written out to the new location. The old location is subsequently removed if the path was changed. So technically this is a "write to a new filepath" and "remove old filepath"
I'm open to either solution. Ultimately in my opinion this comes down to whether we think it's going to be useful to selectively enable renames in certain datafiles, but not in others. I guess I'm leaning towards yes (i.e. something like |
@tbabej thanks for the thorough explanation!
I'm inclined to agree. Please proceed with adding tests and documentation! |
Any update on this? This was a nice to have feature, sad it is stale since |
@devlounge would you be willing to lend a hand? I can rebase this MR on top of the newest |
This MR implements the necessary logic to allow the Mapper to write the datafile to a new location if the filepath has changed due to the user changing the attributes that are reflected in the filepath itself. The behaviour is gated behind
rename=True
flag (or its equivalents in the Meta class).Prior to merging:
Closes #303.