Skip to content

Commit

Permalink
fix: Add person_id to person model and enforce ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfarias committed Jun 20, 2024
1 parent 740188b commit 525c682
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions posthog/batch_exports/sql.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
CREATE_PERSONS_BATCH_EXPORT_VIEW = """
CREATE OR REPLACE VIEW persons_batch_export AS (
SELECT
pd.team_id,
pd.distinct_id,
p.properties,
pd._timestamp AS _timestamp,
NOW64() AS _inserted_at
pd.team_id AS team_id,
pd.distinct_id AS distinct_id,
toString(p.id) AS person_id,
p.properties AS properties,
pd._timestamp AS _inserted_at
FROM (
SELECT
team_id,
Expand All @@ -27,6 +27,8 @@
AND p.team_id = {team_id:Int64}
AND pd._timestamp >= {interval_start:DateTime64}
AND pd._timestamp < {interval_end:DateTime64}
ORDER BY
_inserted_at
)
"""

Expand Down

0 comments on commit 525c682

Please sign in to comment.