MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / _get_clickhouse_client

Function _get_clickhouse_client

api/experimentation/services.py:102–112  ·  view source on GitHub ↗

Build a clickhouse-driver client for the experimentation event store. The database is taken from the DSN path, so queries can reference the `events` table unqualified. Connect and query timeouts are bounded unless the DSN overrides them.

()

Source from the content-addressed store, hash-verified

100
101@lru_cache(maxsize=1)
102def _get_clickhouse_client() -> Client:
103 """Build a clickhouse-driver client for the experimentation event store.
104
105 The database is taken from the DSN path, so queries can reference the
106 `events` table unqualified. Connect and query timeouts are bounded unless the
107 DSN overrides them.
108 """
109 host, kwargs = parse_url(settings.EXPERIMENTATION_CLICKHOUSE_URL)
110 kwargs.setdefault("connect_timeout", CLICKHOUSE_CONNECT_TIMEOUT_SECONDS)
111 kwargs.setdefault("send_receive_timeout", CLICKHOUSE_QUERY_TIMEOUT_SECONDS)
112 return Client(host, **kwargs)
113
114
115def get_unique_event_names(environment_key: str) -> list[str]:

Callers 4

get_unique_event_namesFunction · 0.85
get_exposure_bucketsFunction · 0.85
get_metric_variant_statsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…