: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(replay-vision): run identity lookups as the replay_vision user (#125853)
Tommy Gilmorefe833f8b0099
diff --git a/products/replay_vision/backend/queries/session_group_keys.py b/products/replay_vision/backend/queries/session_group_keys.pyindex a38c72bfbeba..77c111b13bdc 100644--- a/products/replay_vision/backend/queries/session_group_keys.py+++ b/products/replay_vision/backend/queries/session_group_keys.py@@ -6,6 +6,7 @@ from posthog.hogql import astfrom posthog.hogql.parser import parse_selectfrom posthog.hogql.query import execute_hogql_query+from posthog.clickhouse.client.connection import ClickHouseUserfrom posthog.clickhouse.query_tagging import Feature, Product, tag_queriesfrom posthog.models import Team@@ -42,7 +43,7 @@ def fetch_session_group_keys(*, team: Team, session_id: str, start: dt.datetime,"end": ast.Constant(value=end + _TIMESTAMP_SLACK),},)- response = execute_hogql_query(query=query, team=team)+ response = execute_hogql_query(query=query, team=team, ch_user=ClickHouseUser.REPLAY_VISION)if not response.results:return {}row = response.results[0]@@ -68,7 +69,7 @@ def fetch_group_display_names(*, team: Team, group_keys: dict[int, str]) -> dict"SELECT index, key, properties.name AS name FROM groups WHERE (index, key) IN {pairs}",placeholders={"pairs": pairs},)- response = execute_hogql_query(query=query, team=team)+ response = execute_hogql_query(query=query, team=team, ch_user=ClickHouseUser.REPLAY_VISION)names: dict[int, str] = {}for index, _key, name in response.results or []:cleaned = clean_identity_value(name)diff --git a/products/replay_vision/backend/queries/session_identity.py b/products/replay_vision/backend/queries/session_identity.pyindex e233e2c018cc..e7beefd7d132 100644--- a/products/replay_vision/backend/queries/session_identity.py+++ b/products/replay_vision/backend/queries/session_identity.py@@ -15,6 +15,7 @@ from posthog.hogql.escape_sql import escape_hogql_identifierfrom posthog.hogql.parser import parse_selectfrom posthog.hogql.query import execute_hogql_query+from posthog.clickhouse.client.connection import ClickHouseUserfrom posthog.clickhouse.query_tagging import Feature, Product, tag_queriesfrom posthog.models import Team@@ -109,7 +110,7 @@ def fetch_session_person_properties("end": ast.Constant(value=end + IDENTITY_TIMESTAMP_SLACK),},)- response = execute_hogql_query(query=query, team=team)+ response = execute_hogql_query(query=query, team=team, ch_user=ClickHouseUser.REPLAY_VISION)if not response.results:return {}return person_properties_from_row(response.results[0])