mirror of
https://github.com/PostHog/posthog.git
synced 2024-12-01 12:21:02 +01:00
1eeed28751
* add test runner to ease pycharm dev * fix broken import * drop and recreate the clickhouse test db before running tests * fix person uuid str json serialization issue * make kafka optional in tests * fix inits * remove need for kafka in person.py * fix a bunch of mypy errors * fix function and add process_event to pipeline * fixed missing params and tests * change uuid and fix types * types * optimize for merge prop test * make ClickhouseProducer to produce to clickhouse one way or another * annotate types Co-authored-by: Eric <eeoneric@gmail.com> Co-authored-by: James Greenhill <fuziontech@gmail.com>
51 lines
1.7 KiB
Python
51 lines
1.7 KiB
Python
from ee.clickhouse.client import async_execute, sync_execute
|
|
from ee.clickhouse.sql.elements import (
|
|
DROP_ELEMENTS_GROUP_TABLE_SQL,
|
|
DROP_ELEMENTS_TABLE_SQL,
|
|
ELEMENTS_GROUP_TABLE_SQL,
|
|
ELEMENTS_TABLE_SQL,
|
|
)
|
|
from ee.clickhouse.sql.events import (
|
|
DROP_EVENTS_TABLE_SQL,
|
|
DROP_EVENTS_WITH_ARRAY_PROPS_TABLE_SQL,
|
|
DROP_MAT_EVENTS_PROP_TABLE_SQL,
|
|
DROP_MAT_EVENTS_WITH_ARRAY_PROPS_TABLE_SQL,
|
|
EVENTS_TABLE_SQL,
|
|
EVENTS_WITH_PROPS_TABLE_SQL,
|
|
MAT_EVENT_PROP_TABLE_SQL,
|
|
MAT_EVENTS_WITH_PROPS_TABLE_SQL,
|
|
)
|
|
from ee.clickhouse.sql.person import (
|
|
DROP_PERSON_DISTINCT_ID_TABLE_SQL,
|
|
DROP_PERSON_TABLE_SQL,
|
|
PERSONS_DISTINCT_ID_TABLE_SQL,
|
|
PERSONS_TABLE_SQL,
|
|
)
|
|
|
|
|
|
class ClickhouseTestMixin:
|
|
def tearDown(self):
|
|
self._destroy_event_tables()
|
|
sync_execute(DROP_ELEMENTS_TABLE_SQL)
|
|
sync_execute(DROP_ELEMENTS_GROUP_TABLE_SQL)
|
|
sync_execute(DROP_PERSON_TABLE_SQL)
|
|
sync_execute(DROP_PERSON_DISTINCT_ID_TABLE_SQL)
|
|
|
|
self._create_event_tables()
|
|
sync_execute(ELEMENTS_TABLE_SQL)
|
|
sync_execute(ELEMENTS_GROUP_TABLE_SQL)
|
|
sync_execute(PERSONS_TABLE_SQL)
|
|
sync_execute(PERSONS_DISTINCT_ID_TABLE_SQL)
|
|
|
|
def _destroy_event_tables(self):
|
|
sync_execute(DROP_EVENTS_TABLE_SQL)
|
|
sync_execute(DROP_EVENTS_WITH_ARRAY_PROPS_TABLE_SQL)
|
|
sync_execute(DROP_MAT_EVENTS_WITH_ARRAY_PROPS_TABLE_SQL)
|
|
sync_execute(DROP_MAT_EVENTS_PROP_TABLE_SQL)
|
|
|
|
def _create_event_tables(self):
|
|
sync_execute(EVENTS_TABLE_SQL)
|
|
sync_execute(EVENTS_WITH_PROPS_TABLE_SQL)
|
|
sync_execute(MAT_EVENTS_WITH_PROPS_TABLE_SQL)
|
|
sync_execute(MAT_EVENT_PROP_TABLE_SQL)
|