You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ferruzzi (via GitHub)" <gi...@apache.org> on 2023/07/31 17:29:40 UTC
[GitHub] [airflow] ferruzzi commented on a diff in pull request #32915: Fix handling of single quotes in RedshiftToS3Operator
ferruzzi commented on code in PR #32915:
URL: https://github.com/apache/airflow/pull/32915#discussion_r1279660072
##########
tests/providers/amazon/aws/transfers/test_redshift_to_s3.py:
##########
@@ -395,3 +395,51 @@ def test_table_unloading_using_redshift_data_api(
)
# test sql arg
assert_equal_ignore_multiple_spaces(mock_rs.execute_statement.call_args.kwargs["Sql"], unload_query)
+ @mock.patch("airflow.providers.amazon.aws.hooks.redshift_sql.RedshiftSQLHook.run")
+ def test_query_with_single_quotes(self, mock_run):
+ access_key = "aws_access_key_id"
+ secret_key = "aws_secret_access_key"
+ mock_session.return_value = Session(access_key, secret_key)
+ mock_session.return_value.access_key = access_key
+ mock_session.return_value.secret_key = secret_key
+ mock_session.return_value.token = None
+ mock_connection.return_value = Connection()
+ mock_hook.return_value = Connection()
+ schema = "schema"
+ table = "table"
+ s3_bucket = "bucket"
+ s3_key = "key"
+ unload_options = [
+ "HEADER",
+ ]
+
+ # Test a query with single quotes
+ select_query = "SELECT * FROM table WHERE column = 'value with single quotes'"
Review Comment:
Do we maybe want to parameterize this test to include testing double quotes and maybe missing both types or quotes, just to ensure nothing is breaking?
--
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