red-panda
red-panda copied to clipboard
S3 kwargs are ignored when using df_to_redshift
Using red-panda release 1.0.2:
To Reproduce
Steps to reproduce the behavior:
- Call df_to_redshift, passing in an S3-specific kwarg like ServerSideEncryption="AES256", and also cleanup=False so you can check the file in S3
- Run the above, verifying that it succeeds
- Check the file that was written to S3; it will not have encryption enabled
Expected behavior
Because the underlying df_to_s3 function is creating s3_put_kwargs
based on the kwargs passed to it, I think the expectation is that S3-specific args will be honored when calling df_to_redshift. That doesn't happen because the only kwargs passed to df_to_s3 are ones listed in PANDAS_TOCSV_KWARGS
. I think df_to_s3 needs to receive both "to csv" kwargs and "to s3" kwargs.
Totally makes sense. Would be great if you could make a pull request with the proposed changes. Thanks.
In the mean time I suppose you could subclass RedPanda
and override the df_to_redshift
method to avoid filtering PANDAS_TOCSV_KWARGS
only.