: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(warehouse): coerce Intercom assignee ids to string (#74763)
Kyle Swankccb9133e72bc
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/settings.pyindex a597c1dc66ea..98598622682a 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/settings.py@@ -111,6 +111,7 @@ INTERCOM_ENDPOINTS: dict[str, IntercomEndpointConfig] = {paginator_kind="search",method="POST",partition_key="created_at",+ coerce_string_fields=["admin_assignee_id", "team_assignee_id"],),"tickets": IntercomEndpointConfig(# `POST /tickets/search` mirrors contacts/conversations: it accepts@@ -122,6 +123,7 @@ INTERCOM_ENDPOINTS: dict[str, IntercomEndpointConfig] = {paginator_kind="search",method="POST",partition_key="created_at",+ coerce_string_fields=["admin_assignee_id", "team_assignee_id"],),"articles": IntercomEndpointConfig(name="articles",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/tests/test_intercom.py b/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/tests/test_intercom.pyindex 2832d11e7558..dcca7164817b 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/tests/test_intercom.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/tests/test_intercom.py@@ -271,6 +271,28 @@ class TestCoerceStringFields:assert data_map is not Noneassert data_map({"owner_id": 7, "id": "c1"}) == {"owner_id": "7", "id": "c1"}+ @pytest.mark.parametrize("name", ["conversations", "tickets"])+ def test_assignee_ids_data_map_coerces_to_str(self, name: str):+ # REST-path wiring for both streams carrying flat assignee ids: Intercom returns+ # team_assignee_id as an int on some rows and a string on others, which produced+ # int64-vs-string parquet batches that pa.unify_schemas refused to merge. An+ # unassigned id stays None so the column remains nullable.+ resource = get_resource(+ name, should_use_incremental_field=False, incremental_field=None, db_incremental_field_last_value=None+ )+ data_map = resource.get("data_map")+ assert data_map is not None+ assert data_map({"id": "1", "admin_assignee_id": 12345, "team_assignee_id": 678}) == {+ "id": "1",+ "admin_assignee_id": "12345",+ "team_assignee_id": "678",+ }+ assert data_map({"id": "2", "admin_assignee_id": None, "team_assignee_id": "678"}) == {+ "id": "2",+ "admin_assignee_id": None,+ "team_assignee_id": "678",+ }+def test_endpoint_without_coerce_fields_has_no_data_map(self):# Only endpoints declaring coerce_string_fields get a data_map — others stay untouched.resource = get_resource(