potiuk commented on a change in pull request #7688: [AIRFLOW-6794] Allow AWS Operator RedshiftToS3Transfer To Run a Custom Query URL: https://github.com/apache/airflow/pull/7688#discussion_r390753368
########## File path: airflow/providers/amazon/aws/operators/redshift_to_s3.py ########## @@ -107,7 +112,12 @@ def execute(self, context): credentials = s3_hook.get_credentials() unload_options = '\n\t\t\t'.join(self.unload_options) s3_key = '{}/{}_'.format(self.s3_key, self.table) if self.table_as_file_name else self.s3_key - select_query = "SELECT * FROM {schema}.{table}".format(schema=self.schema, table=self.table) + if not self.custom_select_query: + if (not self.schema) or (not self.table): + raise AirflowBadRequest("schema, table set to None") + select_query = "SELECT * FROM {schema}.{table}".format(schema=self.schema, table=self.table) + else: + select_query = self.custom_select_query Review comment: That would be more pythonic. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services