From f8b9177efc3c7d8f2955401ecb0c1e2e0e8df3f3 Mon Sep 17 00:00:00 2001 From: Austin Weisgrau Date: Sun, 6 Oct 2024 14:27:38 -0700 Subject: [PATCH] postgres escape column name in updated_at_rows query This is necessary if, for example, the column name is not all lowercase --- parsons/databases/postgres/postgres.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/parsons/databases/postgres/postgres.py b/parsons/databases/postgres/postgres.py index 87345b4143..833d4a7d22 100644 --- a/parsons/databases/postgres/postgres.py +++ b/parsons/databases/postgres/postgres.py @@ -127,6 +127,12 @@ def get_updated_rows( FROM {self.table} WHERE "{updated_at_column}" > %s """ + parameters = [] + + if cutoff_value is not None: + sql += f'WHERE "{updated_at_column}" > %s' + parameters.append(cutoff_value) + if chunk_size: sql += f" LIMIT {chunk_size}"