How to upload HDF5 file directly to S3 bucket in Python

蓝咒 提交于 2020-02-25 05:52:20

问题


I want to upload a HDF5 file created with h5py to S3 bucket without saving locally using boto3.

This solution uses pickle.dumps and pickle.loads and other solutions I have found, store the file locally which I like to avoid.


回答1:


You can use io.BytesIO() to and put_object as illustrated here 6. Hope this helps. Even in this case, you'd have to 'store' the data locally(though 'in memory'). You could also create a tempfile.TemporaryFile and then upload your file with put_object. I don't think you can stream to an S3 Buckets in the sense that the local data would be discarded as it is uploaded to the Bucket.



来源:https://stackoverflow.com/questions/53788762/how-to-upload-hdf5-file-directly-to-s3-bucket-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!