You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "cjames23 (via GitHub)" <gi...@apache.org> on 2023/08/04 06:38:57 UTC

[GitHub] [airflow] cjames23 commented on a diff in pull request #32915: Fix handling of single quotes in RedshiftToS3Operator

cjames23 commented on code in PR #32915:
URL: https://github.com/apache/airflow/pull/32915#discussion_r1284040547


##########
airflow/providers/amazon/aws/transfers/redshift_to_s3.py:
##########
@@ -144,7 +144,7 @@ def _build_unload_query(
         self, credentials_block: str, select_query: str, s3_key: str, unload_options: str
     ) -> str:
         return f"""
-                    UNLOAD ('{select_query}')
+                    UNLOAD ($${select_query}$$)

Review Comment:
   I am not sure this is something worth going to deep on to work around a very limited amount of edge cases. The only use of double quotes would be around column names that contain illegal character sequences. single quotes are for literals which is really going to cover 99% of usage in my opinion. @vincbeck did you have other edge cases in mind from that comment? One other way to approach this would be to simply regex replace any single quote within the string with double single quotes as given in the Redshift Unload docs and continue to wrap the entire query in single quotes. That would cover the double quote usage edge case. 



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org