From 3ab3b0807459b3dfc42882aa8d48ad24b6b87240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Far=C3=ADas=20Santana?= Date: Fri, 17 Nov 2023 10:52:22 +0100 Subject: [PATCH] fix: Do not use E escape --- posthog/temporal/workflows/redshift_batch_export.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/posthog/temporal/workflows/redshift_batch_export.py b/posthog/temporal/workflows/redshift_batch_export.py index 520c8e0f4b12a..fd2ba4c9e9193 100644 --- a/posthog/temporal/workflows/redshift_batch_export.py +++ b/posthog/temporal/workflows/redshift_batch_export.py @@ -133,8 +133,10 @@ async def insert_records_to_redshift( pre_query_str = pre_query.as_string(cursor).encode("utf-8") async def flush_to_redshift(batch): - await cursor.execute(pre_query_str + b",".join(batch)) - rows_exported.add(len(batch) - 1) + values = b",".join(batch).replace(b" E'", b" '") + + await cursor.execute(pre_query_str + values) + rows_exported.add(len(batch)) # It would be nice to record BYTES_EXPORTED for Redshift, but it's not worth estimating # the byte size of each batch the way things are currently written. We can revisit this # in the future if we decide it's useful enough.