mirror of
https://github.com/PostHog/posthog.git
synced 2024-12-01 04:12:23 +01:00
a39596c092
* Migration to use materialized columns for groups Workaround for https://github.com/PostHog/posthog/issues/6422 * Use groups materialized columns in queries * Update mat column creation tests * Simplify aggregation_target_field * Fix migration * Update snapshots
19 lines
584 B
Python
19 lines
584 B
Python
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)]
|