red-panda icon indicating copy to clipboard operation
red-panda copied to clipboard

S3 kwargs are ignored when using df_to_redshift

Open rjrudin opened this issue 3 years ago • 1 comments

Using red-panda release 1.0.2:

To Reproduce

Steps to reproduce the behavior:

  1. 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
  2. Run the above, verifying that it succeeds
  3. 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.

rjrudin avatar Feb 09 '22 18:02 rjrudin

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.

yaojiach avatar Feb 10 '22 03:02 yaojiach