: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
feat(experiments): add the experiments clickhouse user (#119899)
Rodrigo Iloroaaf730d878b8
diff --git a/posthog/clickhouse/client/connection.py b/posthog/clickhouse/client/connection.pyindex 3ba257a2ec5b..586900ac49ea 100644--- a/posthog/clickhouse/client/connection.py+++ b/posthog/clickhouse/client/connection.py@@ -109,6 +109,7 @@ class ClickHouseUser(StrEnum):# Notebook frame materializations (Temporal worker streaming to the object store)NOTEBOOKS = "notebooks"ERROR_TRACKING = "error_tracking"+ EXPERIMENTS = "experiments" # experiment metric recalculation workers; API reads use APPSIGNALS = "signals"ENDPOINTS = "endpoints"BILLING = "billing"diff --git a/posthog/clickhouse/client/test/test_connection.py b/posthog/clickhouse/client/test/test_connection.pyindex 694766597d73..bb5eb2175ed9 100644--- a/posthog/clickhouse/client/test/test_connection.py+++ b/posthog/clickhouse/client/test/test_connection.py@@ -249,7 +249,7 @@ def test_read_password_uses_static_only_for_an_armed_user_with_an_expired_token(assert creds.read_password() == (password if expect_static else token)[email protected]("user", [ClickHouseUser.COHORTS, ClickHouseUser.SIGNALS])[email protected]("user", [ClickHouseUser.COHORTS, ClickHouseUser.SIGNALS, ClickHouseUser.EXPERIMENTS])def test_password_file_env_registers_file_backed_user(monkeypatch, tmp_path, user):token = tmp_path / "cohorts-token"token.write_text("cohorts-token-value")@@ -285,6 +285,14 @@ def test_signals_development_credentials_do_not_mask_deployment_config(assert (creds.user if creds else None) == expected_user[email protected]("user", [ClickHouseUser.COHORTS, ClickHouseUser.EXPERIMENTS])+def test_unregistered_dedicated_user_falls_back_to_default(monkeypatch, user):+ default_creds = ClickHouseCredentials(user="default", password="default-password")+ monkeypatch.setattr(connection, "__user_dict", {ClickHouseUser.DEFAULT: default_creds})++ assert get_clickhouse_creds(user) == default_creds++@pytest.mark.parametrize("user", [ClickHouseUser.BUSINESS_KNOWLEDGE, ClickHouseUser.SIGNALS])def test_dedicated_credentials_do_not_fall_back_to_default(monkeypatch, user):default_creds = ClickHouseCredentials(user="default", password="default-password")