Skip to content

Commit

Permalink
get_updated_rows pulls all rows if cutoff_value is None
Browse files Browse the repository at this point in the history
without this change, the query fails to parse
  • Loading branch information
austinweisgrau committed Oct 14, 2024
1 parent 454c5fe commit b9d6d45
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions parsons/databases/postgres/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b9d6d45

Please sign in to comment.