diff --git a/parsons/databases/postgres/postgres.py b/parsons/databases/postgres/postgres.py index 87345b4143..18c2a61135 100644 --- a/parsons/databases/postgres/postgres.py +++ b/parsons/databases/postgres/postgres.py @@ -125,13 +125,18 @@ def get_updated_rows( sql = f""" SELECT * 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}" sql += f" OFFSET {offset}" - result = self.db.query(sql, parameters=[cutoff_value]) + result = self.db.query(sql, parameters=parameters) return result