aws-sdk-pandas: `wr.s3.to_deltalake` throwing TypeError about storage_options
Describe the bug
Calling we.s3.to_deltalake() throws the following error:
self._table = RawDeltaTable(
^^^^^^^^^^^^^^
TypeError: argument 'storage_options': 'NoneType' object cannot be converted to 'PyString'
How to Reproduce
wr.s3.to_deltalake(
df=data,
path="s3://bucket/delta",
index=False,
partition_cols=["a", "b"],
overwrite_schema=True,
s3_additional_kwargs={
"AWS_ACCESS_KEY_ID": "...",
"AWS_SECRET_ACCESS_KEY": "...",
"AWS_REGION": "eu-west-1",
},
s3_allow_unsafe_rename=True,
)
Expected behavior
I’d expect awswrangler to connect to S3 and write the delta table.
Your project
No response
Screenshots
No response
OS
Mac
Python version
3.11.4
AWS SDK for pandas version
3.2.1
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 15 (2 by maintainers)
I just set the unused AWS_SESSION_TOKEN to an empty string to override it from being set to None when calling to_deltalake to fix the issue:
The
s3_additional_kwargsargument is for passing S3 specific arguments likeServerSideEncryption, not your AWS credentials. The boto3 session is used to extract the credentials and the region. So as long as that is correctly configured and passed, it should be enough: