Skip to content

: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.

fix(django): wrong db choice for gtm eventual consistency (#64705)

Nick Best577ae9d5052d
diff --git a/posthog/models/group_type_mapping.py b/posthog/models/group_type_mapping.py
index 31ec428af5f0..c53c2c8f33fc 100644
--- a/posthog/models/group_type_mapping.py
+++ b/posthog/models/group_type_mapping.py
@@ -20,7 +20,7 @@ import structlog
from prometheus_client import Counter
from posthog.models.utils import RootTeamMixin
-from posthog.person_db_router import PERSONS_DB_FOR_WRITE
+from posthog.person_db_router import PERSONS_DB_FOR_READ, PERSONS_DB_FOR_WRITE
from posthog.personhog_client import ReadConsistency, consistency_to_read_options
from posthog.personhog_client.caller_tag import personhog_caller_tag
from posthog.personhog_client.metrics import PERSONHOG_ROUTING_ERRORS_TOTAL, PERSONHOG_ROUTING_TOTAL, get_client_name
@@ -529,7 +529,7 @@ def _fetch_group_types_for_project_direct(
from posthog.personhog_client.converters import proto_group_type_mapping_to_dict
from posthog.personhog_client.proto import GetGroupTypeMappingsByProjectIdRequest
- db_alias = PERSONS_DB_FOR_WRITE if consistency == "strong" else "default"
+ db_alias = PERSONS_DB_FOR_WRITE if consistency == "strong" else PERSONS_DB_FOR_READ
return _personhog_routed(
"get_group_types_for_project_direct",