:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(tests): stop hardcoding the clickhouse database name (#94458)
Raúl Negrón-Oteroccb9e8a1dbad
diff --git a/posthog/hogql/database/test/test_s3_table_clickhouse.py b/posthog/hogql/database/test/test_s3_table_clickhouse.pyindex 9b6e561226af..29a1b841a139 100644--- a/posthog/hogql/database/test/test_s3_table_clickhouse.py+++ b/posthog/hogql/database/test/test_s3_table_clickhouse.py@@ -133,7 +133,7 @@ class TestS3ParquetTimezoneConversion(ClickhouseTestMixin, BaseTest):def test_not_affected_on_mergetree(self):"""The bug does not affect regular MergeTree tables."""- table_name = "posthog_test.test_tz_bug_mergetree"+ table_name = "test_tz_bug_mergetree"sync_execute(f"DROP TABLE IF EXISTS {table_name}")sync_execute(f"""CREATE TABLE {table_name} (diff --git a/posthog/hogql/printer/test/test_printer.py b/posthog/hogql/printer/test/test_printer.pyindex f78a510c4e17..173e419dec93 100644--- a/posthog/hogql/printer/test/test_printer.py+++ b/posthog/hogql/printer/test/test_printer.py@@ -4020,9 +4020,9 @@ class TestPrinter(BaseTest):)assert (self._with_active_events_table(- "SELECT coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'domain_type', "+ f"SELECT coalesce(dictGetOrNull('{CLICKHOUSE_DATABASE}.channel_definition_dict', 'domain_type', ""(coalesce(%(hogql_val_0)s, ''), 'source')), "- "dictGetOrNull('posthog_test.channel_definition_dict', 'domain_type', "+ f"dictGetOrNull('{CLICKHOUSE_DATABASE}.channel_definition_dict', 'domain_type', ""(cutToFirstSignificantSubdomain(coalesce(%(hogql_val_0)s, '')), 'source'))) AS domain "f"FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 50000 SETTINGS ""readonly=2, max_execution_time=10, allow_experimental_object_type=1, "@@ -4039,9 +4039,9 @@ class TestPrinter(BaseTest):)assert (self._with_active_events_table(- "SELECT coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', "+ f"SELECT coalesce(dictGetOrNull('{CLICKHOUSE_DATABASE}.channel_definition_dict', 'type_if_paid', ""(coalesce(%(hogql_val_0)s, ''), 'source')) , "- "dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', "+ f"dictGetOrNull('{CLICKHOUSE_DATABASE}.channel_definition_dict', 'type_if_paid', ""(cutToFirstSignificantSubdomain(coalesce(%(hogql_val_0)s, '')), 'source'))) AS source "f"FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 50000 SETTINGS ""readonly=2, max_execution_time=10, allow_experimental_object_type=1, "@@ -4058,7 +4058,7 @@ class TestPrinter(BaseTest):)assert (self._with_active_events_table(- "SELECT dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', "+ f"SELECT dictGetOrNull('{CLICKHOUSE_DATABASE}.channel_definition_dict', 'type_if_paid', ""(coalesce(%(hogql_val_0)s, ''), 'medium')) AS medium "f"FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT {MAX_SELECT_RETURNED_ROWS} SETTINGS ""readonly=2, max_execution_time=10, allow_experimental_object_type=1, max_ast_elements=4000000, max_expanded_ast_elements=4000000, max_bytes_before_external_group_by=0, transform_null_in=1, optimize_min_equality_disjunction_chain_length=4294967295, optimize_rewrite_aggregate_function_with_if=0, optimize_min_inequality_conjunction_chain_length=4294967295, allow_experimental_join_condition=1, use_hive_partitioning=0"@@ -4073,9 +4073,9 @@ class TestPrinter(BaseTest):)assert (self._with_active_events_table(- "SELECT coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', "+ f"SELECT coalesce(dictGetOrNull('{CLICKHOUSE_DATABASE}.channel_definition_dict', 'type_if_organic', ""(coalesce(%(hogql_val_0)s, ''), 'source')), "- "dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', "+ f"dictGetOrNull('{CLICKHOUSE_DATABASE}.channel_definition_dict', 'type_if_organic', ""(cutToFirstSignificantSubdomain(coalesce(%(hogql_val_0)s, '')), 'source'))) AS source "f"FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 50000 SETTINGS ""readonly=2, max_execution_time=10, allow_experimental_object_type=1, "@@ -4092,7 +4092,7 @@ class TestPrinter(BaseTest):)assert (self._with_active_events_table(- "SELECT dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', "+ f"SELECT dictGetOrNull('{CLICKHOUSE_DATABASE}.channel_definition_dict', 'type_if_organic', ""(coalesce(%(hogql_val_0)s, ''), 'medium')) AS medium "f"FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT {MAX_SELECT_RETURNED_ROWS} SETTINGS ""readonly=2, max_execution_time=10, allow_experimental_object_type=1, max_ast_elements=4000000, max_expanded_ast_elements=4000000, max_bytes_before_external_group_by=0, transform_null_in=1, optimize_min_equality_disjunction_chain_length=4294967295, optimize_rewrite_aggregate_function_with_if=0, optimize_min_inequality_conjunction_chain_length=4294967295, allow_experimental_join_condition=1, use_hive_partitioning=0"