ashb commented on a change in pull request #5994: [AIRFLOW-5395] Fix unloading
with column names containing a dot in RedshiftToS3Operator
URL: https://github.com/apache/airflow/pull/5994#discussion_r329517967
##########
File path: airflow/operators/redshift_to_s3_operator.py
##########
@@ -106,13 +114,13 @@ def execute(self, context):
""".format(schema=self.schema,
table=self.table)
- cursor = self.hook.get_conn().cursor()
+ cursor = postgres_hook.get_conn().cursor()
cursor.execute(columns_query)
rows = cursor.fetchall()
columns = [row[0] for row in rows]
- column_names = ', '.join("{0}".format(c) for c in columns)
+ column_names = ', '.join('"{0}"'.format(c) for c in columns)
Review comment:
Lets use `from psycopg2.extensions import quote_ident` to be more resilient.
```suggestion
column_names = ', '.join(quote_ident(c, scope=cursor) in columns)
```
----------------------------------------------------------------
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