-
Notifications
You must be signed in to change notification settings - Fork 41
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
Feature request: Support for S3 version IDs #126
Comments
Hi @nlangellier Thanks for the feature request Basically I don't have an issue adding S3 features as long that we are not changing the basic pathlib api and keeping our api as similar as posible can you show me here what will be the change in the usage of s3path? I'll give you example:
Does that make sense for you? |
What I was suggesting would look like one of the following path = S3Path('/<bucket>/<key>', version_id='<version_id>')
path = S3Path.from_uri('s3://<bucket>/<key>', version_id='<version_id>')
path = S3Path.from_bucket_key(bucket='<bucket>', key='<key>', version_id='<version_id>') This would only be an addition on top of the current API so the following would still work as usual: path = S3Path('/<bucket>/<key>')
path = S3Path.from_uri('s3://<bucket>/<key>')
path = S3Path.from_bucket_key(bucket='<bucket>', key='<key>') But you are right that this would constitute a deviation from the Are you implying with your suggestion of path = S3Path('/<bucket>/<key>?VersionID=<version_id>') that we would parse the input S3 path string in a similar way that query params are parsed in a URL? If so I could certainly make that work. I would call out that '?' is a valid S3 object name character, but it is specifically called out by AWS as a character that might need special treatment, so perhaps it's OK. Thoughts? |
Thats exactly what I mean yes |
In the class constructors it should be a simple matter to extract out the If we are not OK with this edge case, I can think of some additional options for implementation:
What do you think about the |
@liormizr When implementing the I would personally vote for the third option above (i.e. |
Hi @nlangellier I agree with you, I think that for the first step to create a VersionedS3Path is the best approach. So what I think that is the next steps:
What do you think? |
Perfect. I will put up a PR in the coming days fulfilling each of the bullet points you listed. |
We merged the PR |
Deployed in version 0.5.0 |
Hi @liormizr It would be nice to allow accessing specific versions of S3 objects for buckets that have enabled versioning.
This could be accomplished by adding an optional
version_id=None
argument toPureS3Path.from_uri
andPureS3Path.from_bucket_key
as well as definingS3Path.__new__
like the following:Then
_S3Accessor.open
would update thetransport_params
dict to includepath.version_id
if it is notNone
.I already have a working prototype ready for pull request if you approve of the idea.
What do you think?
The text was updated successfully, but these errors were encountered: