to_csv 函数中的服务器端加密

Server Side Encryption in to_csv function

我在使用 to_csv("s3://mys3bucket/result.csv")

时遇到此错误
Exception: [Errno Write Failed: mys3bucket/result.csv/2489.part]
An error occurred (AccessDenied) when calling the PutObject operation: Access Denied

可能是因为Dask没有使用服务器端加密造成的。请告诉我如何让它使用 SSE 或其他方法成功将文件写入 s3 存储桶

扩展@user32185 的评论,为了通过 dask 控制 SSE,您的调用应该如下所示:

to_csv("s3://mys3bucket/result.csv",
       storage_option={'s3_additional_kwargs':
           {'ServerSideEncryption': 'AES256'}})

其中详细介绍了使用 s3fs 的 SSE 的细节here. Note that you may also require other keywords from the same docs page, for credentials, storage zone, etc. The parameters are passed to the S3FileSystem constructor,您可以深入研究 boto 文档以了解所有内容的含义。