0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 18:26:15 +01:00
posthog/ee/clickhouse/migrations/0019_group_analytics_materialized_columns.py

19 lines
584 B
Python
Raw Normal View History

from infi.clickhouse_orm import migrations
from ee.clickhouse.materialized_columns.columns import materialize
def create_materialized_columns(database):
try:
materialize("events", "$group_0", "$group_0")
materialize("events", "$group_1", "$group_1")
materialize("events", "$group_2", "$group_2")
materialize("events", "$group_3", "$group_3")
materialize("events", "$group_4", "$group_4")
except ValueError:
# Group is already materialized, skip
pass
operations = [migrations.RunPython(create_materialized_columns)]