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


##########
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:
   Thank you for raising this concern. @vincbeck  You are right that using 
dollar quoting might not be sufficient for queries that already use double 
quotes. Currently, the suggested change in the code does not account for 
queries using double quotes, and it may not work as expected in those cases.
   
   To address this issue, one possible solution is to detect if the query 
contains double quotes and, if it does, avoid using dollar quoting. Instead, 
the operator can dynamically determine the appropriate quoting method based on 
the query content.
   
   Additionally, to ensure the robustness of the operator, it is essential to 
include unit tests that cover various use cases, including queries with single 
quotes, double quotes, and combinations of both. By adding comprehensive unit 
tests, we can verify that the `RedshiftToS3 `Operator works correctly with 
different types of queries.
   
   By implementing these changes and enhancing the operator with proper 
handling of both single and double quotes, we can provide a more reliable and 
versatile solution for users dealing with complex queries. 



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

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to