-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix column order difference between creation and migration
- Loading branch information
Showing
3 changed files
with
44 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from posthog.clickhouse.client import sync_execute | ||
from posthog.models.raw_sessions.sql import RAW_SESSION_TABLE_BACKFILL_SELECT_SQL | ||
from posthog.models.utils import uuid7 | ||
from posthog.test.base import ( | ||
_create_event, | ||
ClickhouseTestMixin, | ||
BaseTest, | ||
) | ||
|
||
|
||
class TestRawSessionsModel(ClickhouseTestMixin, BaseTest): | ||
def test_backfill_sql(self): | ||
distinct_id = str(uuid7()) | ||
session_id = str(uuid7()) | ||
_create_event( | ||
team=self.team, | ||
event="$pageview", | ||
distinct_id=distinct_id, | ||
properties={"$current_url": "/", "$session_id": session_id}, | ||
timestamp="2024-03-08", | ||
) | ||
|
||
# just test that the backfill SQL can be run without error | ||
sync_execute( | ||
"INSERT INTO raw_sessions" + RAW_SESSION_TABLE_BACKFILL_SELECT_SQL() + "AND team_id = %(team_id)s", | ||
{"team_id": self.team.id}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters