-
Notifications
You must be signed in to change notification settings - Fork 21
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 file-like protocol #9
Comments
i'm going to rename this issue |
@kennethreitz I am currently working on this. I think I am either:
I think option 2 will be the best bet, but an in memory stream might not be the best idea for huge files. Do you have any thoughts? |
@eligundry I'm not familiar with What does boto normally do for large files? |
@kennethreitz Boto is really flexible with what it will take. In all the Bucketstore examples, we clearly see that strings are just handled. But Boto will work fine with any file-like object that you throw at it. I have been working on this a bit and have deviated slightly from the proposed syntax in the OP issue. What this is going to look like is: key = bucket.key('foo')
data = {'hello': 'world'}
with key as fh:
pickle.dump(data, fp, protocol=pickle.HIGHEST_PROTOCOL) In this example, the key is automatically uploaded when it exits the |
i like it! |
@kennethreitz I have this super close, but would love to get some feedback regarding assumptions of the datatypes that this library works with. I noticed that Boto3 will always return This test with At this point, I have a few questions/ideas I'm gonna dump out here:
|
Hmmmmm |
Requests dealt with a similar issue — and there's a lot of code in place to compensate for it. |
assuming bytes for Python3 is sane. |
closing this due to inactivity |
@inishchith We can keep some issue open which have some discussion else we will be left with no open issues. What say? |
It would be great to pickle object directly to S3. Something like this would be helpful.
import bucketstore
bucket = bucketstore.get('bucketstore-playground', create=True)
import pickle
a = {'hello': 'world'}
with open( bucket['foo11'], 'wb') as handle:
pickle.dump(a, handle, protocol=pickle.HIGHEST_PROTOCOL)
The text was updated successfully, but these errors were encountered: