From b6f9dd843e078ec34ecc52a53f255f7d6dcc2beb Mon Sep 17 00:00:00 2001 From: Austin Weisgrau <62900254+austinweisgrau@users.noreply.github.com> Date: Thu, 7 Sep 2023 12:41:47 -0700 Subject: [PATCH] Enable use of "extension" argument to Redshift unload (#871) --- parsons/databases/redshift/redshift.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/parsons/databases/redshift/redshift.py b/parsons/databases/redshift/redshift.py index 84bf0fdebf..a870d90a11 100644 --- a/parsons/databases/redshift/redshift.py +++ b/parsons/databases/redshift/redshift.py @@ -712,6 +712,7 @@ def unload( allow_overwrite=True, parallel=True, max_file_size="6.2 GB", + extension=None, aws_region=None, aws_access_key_id=None, aws_secret_access_key=None, @@ -757,6 +758,8 @@ def unload( max_file_size: str The maximum size of files UNLOAD creates in Amazon S3. Specify a decimal value between 5 MB and 6.2 GB. + extension: str + This extension will be added to the end of file names loaded to S3 region: str The AWS Region where the target Amazon S3 bucket is located. REGION is required for UNLOAD to an Amazon S3 bucket that is not in the same AWS Region as the Amazon Redshift @@ -796,6 +799,8 @@ def unload( statement += "ESCAPE \n" if allow_overwrite: statement += "ALLOWOVERWRITE \n" + if extension: + statement += f"EXTENSION '{extension}' \n" if aws_region: statement += f"REGION {aws_region} \n"