From a4a887c866c362ecdd9ccb9e4df2591a01b90a3f Mon Sep 17 00:00:00 2001 From: AndreasHegerNuritas <163423418+AndreasHegerNuritas@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:38:16 +0100 Subject: [PATCH] =?UTF-8?q?fix(ingest/redshift):=20replace=20r'\n'=20with?= =?UTF-8?q?=20'\n'=20to=20avoid=20token=20error=20redshift=20serverless?= =?UTF-8?q?=E2=80=A6=20(#11111)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datahub/ingestion/source/redshift/redshift_schema.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/metadata-ingestion/src/datahub/ingestion/source/redshift/redshift_schema.py b/metadata-ingestion/src/datahub/ingestion/source/redshift/redshift_schema.py index 6e88a50f898a5..2e628269edbc3 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/redshift/redshift_schema.py +++ b/metadata-ingestion/src/datahub/ingestion/source/redshift/redshift_schema.py @@ -504,7 +504,11 @@ def get_alter_table_commands( yield AlterTableRow( transaction_id=row[field_names.index("transaction_id")], session_id=session_id, - query_text=row[field_names.index("query_text")], + # See https://docs.aws.amazon.com/redshift/latest/dg/r_STL_QUERYTEXT.html + # for why we need to replace the \n with a newline. + query_text=row[field_names.index("query_text")].replace( + r"\n", "\n" + ), start_time=row[field_names.index("start_time")], ) rows = cursor.fetchmany()