: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(data-warehouse): add 1 missing table to the Amplitude source (#118928)
Tom Owers70562c724bbe
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.mdindex 76d934e431a8..f4fb042f29bf 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md@@ -534,10 +534,10 @@ Diffed against: <https://amplitude.com/docs/apis>- [x] `GET /api/2/taxonomy/event-property` — event property definitions and types, needed to interpret the events table (high)- [x] `GET /api/2/taxonomy/user-property` — user property catalog with types and descriptions (high)- [x] `GET /api/2/taxonomy/category` — event category lookup resolving the category IDs on event types (medium)-- [ ] `GET /api/2/taxonomy/group-property` — group property catalog for account-level analysis (medium)-- [ ] `GET /api/2/release` — release markers to join against event timestamps, the sibling of the annotations table already synced (medium)-- [ ] `GET /api/2/audit-logs/{ORG_ID}` — org-level change history for charts, cohorts and permissions (medium)-- [ ] `GET /api/3/chart/{chart_id}/query` — results of saved charts, so warehouse numbers match what teams see in Amplitude (medium)+- [x] `GET /api/2/taxonomy/group-property` — group property catalog for account-level analysis (medium). Added as `group_properties` (shared group properties only, because no Taxonomy endpoint lists group types).+- ~~`GET /api/2/release` — release markers to join against event timestamps, the sibling of the annotations table already synced (medium)~~ — skipped: the Releases API documents only `POST`, so there is no list call+- ~~`GET /api/2/audit-logs/{ORG_ID}` — org-level change history for charts, cohorts and permissions (medium)~~ — skipped: the call is a `POST` that needs organization keys issued by Amplitude Support, not the project keys this source uses+- ~~`GET /api/3/chart/{chart_id}/query` — results of saved charts, so warehouse numbers match what teams see in Amplitude (medium)~~ — skipped: it needs a chart ID from the web app URL (no list call), and the response shape changes with the chart type- [ ] `GET /api/2/funnels` — funnel conversion results as Amplitude computes them (medium)- [ ] `GET /api/2/retention` — retention curves as Amplitude computes them (medium)- [ ] `GET /api/2/composition` — user composition breakdown by property value (low)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/amplitude/api_inventory.md b/products/warehouse_sources/backend/temporal/data_imports/sources/amplitude/api_inventory.mdindex f73d7015590d..6b66c56ea4e0 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/amplitude/api_inventory.md+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/amplitude/api_inventory.md@@ -60,6 +60,23 @@ So `401`/`403` are permanent auth failures (wired into `get_non_retryable_errors- Taxonomy API. Response wrapped in `{"success": true, "data": [...]}`.- Resolves the `category` object carried on each event type.+### `group_properties` — `/api/2/taxonomy/group-property`++- Grain: one shared group property definition. Primary key: `group_property`. Sync mode: full refresh.+- Taxonomy API. Response wrapped in `{"success": true, "data": [...]}`.+- Called without `group_type`, so Amplitude returns the shared group properties of the tracking plan,+ where each name is unique. Per-group-type overrides need a group type name, and no Taxonomy endpoint+ lists group types, so overrides are not synced.+- Custom group properties carry a `grp:` prefix.++## Not synced++- `GET /api/2/release` — the Releases API documents only `POST` (create a release). There is no list call.+- `POST /api/2/audit-logs/{ORG_ID}` — a `POST` that needs an organization API key and secret key issued by+ Amplitude Support, not the project keys this source collects. The response shape is not documented.+- `GET /api/3/chart/{chart_id}/...` — returns the results of one saved chart. The chart ID comes from the+ web app URL (no list call exists), and the response shape changes with the chart type.+## Incremental design (events)The Export API's only server-side filter is the `start`/`end` window on **server upload time**, so@@ -72,7 +89,7 @@ the stable `event_time` field.## Incremental design (taxonomy)No Taxonomy endpoint documents a timestamp filter, a cursor, or any pagination parameter — each "get all"-call returns the complete array. So all four taxonomy tables are full refresh, and none advertise an+call returns the complete array. So all five taxonomy tables are full refresh, and none advertise anincremental field.## Unverified (no credentials to curl)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/amplitude/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/amplitude/canonical_descriptions.pyindex dbd99ac5cc54..c2e20cc26281 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/amplitude/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/amplitude/canonical_descriptions.py@@ -2,7 +2,7 @@Sourced from the official Amplitude HTTP API reference (https://amplitude.com/docs/apis), covering theExport API (events), the Dashboard REST APIs (cohorts, annotations), and the Taxonomy API (event types,-event properties, user properties, event categories). Keyed by the endpoint names in+event properties, user properties, event categories, group properties). Keyed by the endpoint names in`settings.py` `AMPLITUDE_ENDPOINTS`, which match the `ExternalDataSchema.name` of a synced Amplitudetable. Columns absent here fall back to LLM enrichment."""@@ -120,4 +120,19 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"name": "Name of the category — matches the category name carried on event types.",},},+ "group_properties": {+ "description": "A shared group property definition from the tracking plan, describing one property carried on groups (accounts).",+ "docs_url": "https://amplitude.com/docs/apis/analytics/taxonomy",+ "columns": {+ "group_property": "Name of the group property. Custom group properties carry a `grp:` prefix.",+ "group_type": "Name of the group type the property belongs to, when Amplitude returns one.",+ "description": "Description of what the property means, from the tracking plan.",+ "type": "Declared value type of the property (for example string, number, boolean, enum).",+ "regex": "Regular expression the property value must match, if one is set.",+ "enum_values": "Allowed values when the property is declared as an enum.",+ "is_array_type": "Whether the property holds an array of values.",+ "is_hidden": "Whether the property is hidden from pickers in the Amplitude UI.",+ "classifications": "Data classification labels applied to the property.",+ },+ },}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/amplitude/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/amplitude/settings.pyindex a91a2ec00e9b..1e4af414d736 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/amplitude/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/amplitude/settings.py@@ -29,6 +29,7 @@ EVENT_TYPES_ENDPOINT = "event_types"EVENT_PROPERTIES_ENDPOINT = "event_properties"USER_PROPERTIES_ENDPOINT = "user_properties"EVENT_CATEGORIES_ENDPOINT = "event_categories"+GROUP_PROPERTIES_ENDPOINT = "group_properties"TAXONOMY_EVENT_PATH = "/api/2/taxonomy/event"@@ -124,6 +125,14 @@ AMPLITUDE_ENDPOINTS: dict[str, AmplitudeEndpointConfig] = {primary_keys=["id"],data_selector="data",),+ # Without `group_type` Amplitude returns the shared group properties of the tracking plan,+ # where each name is unique. Per-group-type overrides are not listed.+ GROUP_PROPERTIES_ENDPOINT: AmplitudeEndpointConfig(+ name=GROUP_PROPERTIES_ENDPOINT,+ path="/api/2/taxonomy/group-property",+ primary_keys=["group_property"],+ data_selector="data",+ ),}ENDPOINTS = tuple(AMPLITUDE_ENDPOINTS.keys())diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/amplitude/tests/test_amplitude.py b/products/warehouse_sources/backend/temporal/data_imports/sources/amplitude/tests/test_amplitude.pyindex bcdb4c4ea193..df3b7fdc5eec 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/amplitude/tests/test_amplitude.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/amplitude/tests/test_amplitude.py@@ -26,6 +26,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.amplitude.COHORTS_ENDPOINT,EVENT_PROPERTIES_ENDPOINT,EVENTS_ENDPOINT,+ GROUP_PROPERTIES_ENDPOINT,)from products.warehouse_sources.backend.temporal.data_imports.sources.amplitude.source import AmplitudeSourcefrom products.warehouse_sources.backend.temporal.data_imports.sources.common.testing import (@@ -262,16 +263,41 @@ class TestEventsWindowing:class TestListRows:@parameterized.expand([- (COHORTS_ENDPOINT, {"cohorts": [{"id": "c1"}, {"id": "c2"}]}, ["c1", "c2"]),- (ANNOTATIONS_ENDPOINT, {"data": [{"id": 1}]}, [1]),- (COHORTS_ENDPOINT, {"cohorts": []}, []),- (COHORTS_ENDPOINT, {"unexpected": []}, []),+ (COHORTS_ENDPOINT, {"cohorts": [{"id": "c1"}, {"id": "c2"}]}, "/api/3/cohorts", "id", ["c1", "c2"]),+ (ANNOTATIONS_ENDPOINT, {"data": [{"id": 1}]}, "/api/2/annotations", "id", [1]),+ (COHORTS_ENDPOINT, {"cohorts": []}, "/api/3/cohorts", "id", []),+ (COHORTS_ENDPOINT, {"unexpected": []}, "/api/3/cohorts", "id", []),+ (+ GROUP_PROPERTIES_ENDPOINT,+ {+ "success": True,+ "data": [+ {"group_property": "grp:plan_tier", "type": "string", "is_hidden": False},+ {"group_property": "grp:seat_count", "type": "number", "is_array_type": False},+ ],+ },+ "/api/2/taxonomy/group-property",+ "group_property",+ ["grp:plan_tier", "grp:seat_count"],+ ),+ (+ GROUP_PROPERTIES_ENDPOINT,+ {"success": True, "data": []},+ "/api/2/taxonomy/group-property",+ "group_property",+ [],+ ),])- def test_data_selector_extraction(self, endpoint: str, body: Any, expected_ids: list[Any]) -> None:+ def test_data_selector_extraction(+ self, endpoint: str, body: Any, expected_path: str, key_field: str, expected_keys: list[Any]+ ) -> None:result = _driver().run(endpoint, [ScriptedResponse(json=body)])- assert [row["id"] for row in result.rows] == expected_ids+ assert [row[key_field] for row in result.rows] == expected_keys+ assert result.paths == [expected_path]+ # A `group_type` param would narrow group properties to one group type instead of the shared set.+ assert "?" not in result.urls[0]assert result.raised is Nonedef test_bare_list_response_is_yielded(self) -> None: