Skip to content

Commit

Permalink
Fix query builder on Ingestors
Browse files Browse the repository at this point in the history
  • Loading branch information
TeoCalvo authored and TeoCalvo committed Jan 18, 2024
1 parent cb1493d commit 7db38f8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/ingestors.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,14 @@ def default_query(self):
base_query = """SELECT *,
NOW() as ingestion_at
FROM {table} """
ids = ",".join(self.id_fields)
if len(self.partition_fields) > 0:

if len(self.id_fields) > 0:
ids = ",".join(self.id_fields)
window = f"""QUALIFY row_number() OVER (PARTITION BY {ids} ORDER BY {self.timestamp_field} DESC) = 1"""

else:
window = ""

return base_query + window

def load_stream(self):
Expand Down

0 comments on commit 7db38f8

Please sign in to comment.