0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 12:21:02 +01:00

fix: make the ALTER TABLE MODIFY QUERY run ON CLUSTER (#26411)

This commit is contained in:
James Greenhill 2024-11-25 16:43:45 -08:00 committed by GitHub
parent f255be2581
commit 2bd9f57c3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,6 @@
from posthog.clickhouse.client.migration_tools import run_sql_with_exceptions
from posthog.models.raw_sessions.sql import RAW_SESSION_TABLE_UPDATE_SQL
operations = [
run_sql_with_exceptions(RAW_SESSION_TABLE_UPDATE_SQL),
]

View File

@ -409,10 +409,12 @@ AS
RAW_SESSION_TABLE_UPDATE_SQL = (
lambda: """
ALTER TABLE {table_name} MODIFY QUERY
ALTER TABLE {table_name} ON CLUSTER '{cluster}'
MODIFY QUERY
{select_sql}
""".format(
table_name=f"{TABLE_BASE_NAME}_mv",
cluster=settings.CLICKHOUSE_CLUSTER,
select_sql=RAW_SESSION_TABLE_MV_SELECT_SQL(),
)
)