From f35ad606051242cc23bc02fef419b0df51015293 Mon Sep 17 00:00:00 2001 From: Ted Kaemming <65315+tkaemming@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:41:56 -0800 Subject: [PATCH] use the thing that exists that does the thing --- posthog/tasks/usage_report.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/posthog/tasks/usage_report.py b/posthog/tasks/usage_report.py index f21d716f493a9..4b72ce933ab46 100644 --- a/posthog/tasks/usage_report.py +++ b/posthog/tasks/usage_report.py @@ -19,7 +19,6 @@ from posthog import version_requirement from posthog.clickhouse.client.connection import Workload -from posthog.clickhouse.materialized_columns import get_materialized_column_for_property from posthog.client import sync_execute from posthog.cloud_utils import get_cached_instance_license, is_cloud from posthog.constants import FlagRequestType @@ -29,6 +28,7 @@ from posthog.models.feature_flag import FeatureFlag from posthog.models.organization import Organization from posthog.models.plugin import PluginConfig +from posthog.models.property.util import get_property_string_expr from posthog.models.team.team import Team from posthog.models.utils import namedtuplefetchall from posthog.settings import CLICKHOUSE_CLUSTER, INSTANCE_TAG @@ -461,10 +461,7 @@ def get_teams_with_event_count_with_groups_in_period(begin: datetime, end: datet @retry(tries=QUERY_RETRIES, delay=QUERY_RETRY_DELAY, backoff=QUERY_RETRY_BACKOFF) def get_all_event_metrics_in_period(begin: datetime, end: datetime) -> dict[str, list[tuple[int, int]]]: # Check if $lib is materialized - lib_materialized_column = get_materialized_column_for_property("events", "properties", "$lib") - lib_expression = ( - lib_materialized_column.name if lib_materialized_column is not None else "JSONExtractString(properties, '$lib')" - ) + lib_expression, _ = get_property_string_expr("events", "$lib", "'$lib'", "properties") results = sync_execute( f"""