feluelle 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_r400924254
 
 

 ##########
 File path: airflow/providers/amazon/aws/operators/redshift_to_s3.py
 ##########
 @@ -101,13 +106,19 @@ def __init__(  # pylint: disable=too-many-arguments
             self.unload_options = list(self.unload_options) + ['HEADER', ]
 
     def execute(self, context):
+        if all([self.schema, self.table]):
+            select_query = "SELECT * FROM 
{schema}.{table}".format(schema=self.schema, table=self.table)
+        elif self.custom_select_query:
+            select_query = self.custom_select_query
+        else:
+            raise AirflowBadRequest(f"""Either (schema, table) or 
custom_select_query should be set.
+            They are ({self.schema},{self.table}) and 
{self.custom_select_query} now.""")
 
 Review comment:
   ```suggestion
               raise AirflowBadRequest("Either (schema, table) or 
custom_select_query should be set. "
                   f"They are ({self.schema},{self.table}) and 
{self.custom_select_query} now.")
   ```
   If you use triple quotes `"""` it will also print the spaces you have in 
front of `They`. And in this case you probably do not want that.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to