简体   繁体   English

如何在Python中将HDF5文件直接上传到S3存储桶

[英]How to upload HDF5 file directly to S3 bucket in Python

I want to upload a HDF5 file created with h5py to S3 bucket without saving locally using boto3. 我想将使用h5py创建的HDF5文件上传到S3存储桶,而无需使用boto3在本地保存。

This solution uses pickle.dumps and pickle.loads and other solutions I have found, store the file locally which I like to avoid. 解决方案使用pickle.dumps和pickle.loads以及其他我发现的解决方案,将文件存储在本地,这是我希望避免的。

You can use io.BytesIO() to and put_object as illustrated here 6 . 您可以使用io.BytesIO()put_object ,如图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 . 您还可以创建tempfile.TemporaryFile ,然后使用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. 我不认为您可以流式传输到S3存储桶,因为在将本地数据上传到存储桶时,本地数据将被丢弃。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 python将数据而非文件上传到s3存储桶 - python upload data, not file, to s3 bucket 如何将文件上传到 s3(使用 Python),其中 s3 存储桶名称的名称中有斜杠“/” - How to upload a file into s3 (using Python) where the s3 bucket name has a slash '/' in the name 如何在不使用 Pandas 的情况下从 s3 存储桶获取 excel 文件并将文件再次上传到 s3 存储桶 - Python - How to get an excel file from s3 bucket and upload the file again to s3 bucket without using pandas - Python 如何从S3 bucket中直接读取图片文件到memory? - How to read image file from S3 bucket directly into memory? python 中的 HDF5:读取文件 - HDF5 in python: reading file python直接写入S3存储桶 - python to write directly to S3 bucket 如何使用 python 从 Flask 的 HTML 表单上传文件到 S3 存储桶? - How to upload a file from a Flask's HTML form to an S3 bucket using python? 在Python中将json文件上传到s3 Bucket中的特定文件夹 - Upload json File to Specific Folder in s3 Bucket in Python 如何通过python将我的结果作为json文件保存/上传到S3存储桶的子文件夹中 - how to save/upload my result as json file into the sub folders of S3 bucket via python 将 Pandas Dataframe 转换为镜像并直接上传到 S3 存储桶,无需本地保存使用 Python - Convert Pandas Dataframe to Image and Upload Directly to S3 Bucket Without Saving Locally Using Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM