0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-21 13:39:22 +01:00

fully move get_materialized_columns into other path

This commit is contained in:
Ted Kaemming 2024-11-15 18:36:03 -08:00
parent c860620e30
commit d214624191
3 changed files with 12 additions and 13 deletions

View File

@ -117,17 +117,6 @@ class MaterializedColumnDetails:
raise ValueError(f"unexpected comment format: {comment!r}")
def get_materialized_columns(
table: TablesWithMaterializedColumns,
exclude_disabled_columns: bool = False,
) -> dict[tuple[PropertyName, TableColumn], ColumnName]:
return {
(column.details.property_name, column.details.table_column): column.name
for column in MaterializedColumn.get_all(table)
if not (exclude_disabled_columns and column.details.is_disabled)
}
def get_on_cluster_clause_for_table(table: TableWithProperties) -> str:
return f"ON CLUSTER '{CLICKHOUSE_CLUSTER}'" if table == "events" else ""

View File

@ -10,13 +10,13 @@ from ee.clickhouse.materialized_columns.columns import (
MaterializedColumnDetails,
backfill_materialized_columns,
drop_column,
get_materialized_columns,
materialize,
update_column_is_disabled,
)
from posthog.clickhouse.materialized_columns import (
TablesWithMaterializedColumns,
get_enabled_materialized_columns,
get_materialized_columns,
)
from posthog.client import sync_execute
from posthog.conftest import create_clickhouse_tables

View File

@ -10,7 +10,17 @@ ColumnName = str
TablesWithMaterializedColumns = TableWithProperties
if EE_AVAILABLE:
from ee.clickhouse.materialized_columns.columns import get_materialized_columns
from ee.clickhouse.materialized_columns.columns import MaterializedColumn
def get_materialized_columns(
table: TablesWithMaterializedColumns,
exclude_disabled_columns: bool = False,
) -> dict[tuple[PropertyName, TableColumn], ColumnName]:
return {
(column.details.property_name, column.details.table_column): column.name
for column in MaterializedColumn.get_all(table)
if not (exclude_disabled_columns and column.details.is_disabled)
}
else:
def get_materialized_columns(