: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 4 missing tables to the Snowplow source (#116493)
Tom Owers4452d3d8e646
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 6f1c54c236ea..9622a8aeb0db 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@@ -11246,10 +11246,10 @@ Today (7): `data_models`, `data_structures`, `failed_event_metrics`, `job_run_stDiffed against: <https://console.snowplowanalytics.com/api/msc/v1/docs/docs.yaml>-- [ ] `GET /data-products/v2 (plus /metrics and /{dataProductId}/history)` — Data Products are the vendor's headline governance object and /metrics carries their volume numbers (high)-- [ ] `GET /event-specs/v1 (plus /metrics, /{eventSpecId}/versions, /{eventSpecId}/history)` — event specifications with observed-volume metrics and version history - the tracking-quality core (high)-- [ ] `GET /source-apps/v1` — lookup table resolving the source app ids referenced by data products and event specs (high)-- [ ] `GET /data-catalog/v1 (and /data-catalog/v1/search)` — the catalog of events and entities actually observed in the pipeline, the join key between data structures and real traffic (high)+- [x] `GET /data-products/v2 (plus /metrics and /{dataProductId}/history)` — Data Products are the vendor's headline governance object and /metrics carries their volume numbers (high)+- [x] `GET /event-specs/v1 (plus /metrics, /{eventSpecId}/versions, /{eventSpecId}/history)` — event specifications with observed-volume metrics and version history - the tracking-quality core (high)+- [x] `GET /source-apps/v1` — lookup table resolving the source app ids referenced by data products and event specs (high)+- [x] `GET /data-catalog/v1 (and /data-catalog/v1/search)` — the catalog of events and entities actually observed in the pipeline, the join key between data structures and real traffic (high)- [ ] `GET /data-structures/v1/{schemaHash}/deployments` — which schema version is deployed to dev vs prod - deployment state history for structures we already sync (medium)- [ ] `GET /metrics/v1/pipelines/{pipelineId}/failed-events/{errorId}` — per-error breakdown behind the failed-event totals already synced (medium)- [ ] `GET /tracking-scenarios/v2 (plus /metrics and /{scenarioId}/history)` — tracking scenarios and their conformance metrics for orgs not yet migrated to event specs (medium)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/snowplow/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/snowplow/canonical_descriptions.pyindex b4b3ee5fe395..13f7b759ab33 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/snowplow/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/snowplow/canonical_descriptions.py@@ -56,6 +56,78 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"deployments": "Most recent deployment of the schema per environment.",},},+ "data_products": {+ "description": "Data products in your organization: documented groups of event specifications with an owner and a domain.",+ "docs_url": "https://docs.snowplow.io/docs/data-product-studio/data-products/api/",+ "columns": {+ "id": "UUID of the data product.",+ "name": "Name of the data product.",+ "organizationId": "UUID of the organization the data product belongs to.",+ "domain": "Business domain the data product belongs to.",+ "owner": "Email address of the data product's owner.",+ "description": "Description of the data product.",+ "status": "Publication status of the data product (draft, publishing, published, or failed).",+ "accessInstructions": "Instructions on how to access the data the data product describes.",+ "eventSpecs": "References (id and URL) to the event specifications in the data product.",+ "templateReference": "Reference of the template the data product was created from.",+ "sourceApplications": "UUIDs of the source applications the data product is tracked in.",+ "type": "Type of the data product (base, custom, or templated).",+ "createdAt": "When the data product was created.",+ "updatedAt": "When the data product was last updated.",+ "lockStatus": "Whether the data product is locked or unlocked for editing.",+ "managedFrom": "External location the data product is managed from, when it is locked.",+ "sendInvalidToBad": "Whether events that do not match the data product's event specifications go to failed events.",+ },+ },+ "event_specs": {+ "description": "Event specifications: the events a data product expects, with their triggers, event schema, and entities.",+ "docs_url": "https://docs.snowplow.io/docs/data-product-studio/event-specifications/api/",+ "columns": {+ "id": "UUID of the event specification.",+ "version": "Version number of the event specification.",+ "revision": "Revision number of the event specification.",+ "status": "Publication status of the event specification (draft, publishing, published, or failed).",+ "name": "Name of the event specification.",+ "dataProductId": "UUID of the data product the event specification belongs to.",+ "appIds": "Application IDs the event is expected from.",+ "owner": "Owner of the event specification.",+ "description": "Description of the event specification.",+ "triggers": "Descriptions of when the event fires, with the app IDs and URLs they apply to.",+ "event": "The event data structure the specification uses, with any extra schema constraints.",+ "entities": "Entity data structures tracked with or enriched onto the event.",+ "sourceApplications": "UUIDs of the source applications the event is tracked in.",+ "author": "UUID of the user who made the latest change.",+ "message": "Message recorded with the latest change.",+ "date": "When the latest change was made.",+ },+ },+ "source_apps": {+ "description": "Source applications: the apps that send events, with their application IDs and expected entities.",+ "docs_url": "https://docs.snowplow.io/docs/data-product-studio/source-applications/",+ "columns": {+ "id": "UUID of the source application.",+ "name": "Name of the source application.",+ "description": "Description of the source application.",+ "owner": "Email address of the source application's owner.",+ "appIds": "Application IDs the source application sends events with.",+ "entities": "Entity data structures tracked with or enriched onto the application's events.",+ "tracker": "The Snowplow tracker the source application uses.",+ "lockStatus": "Whether the source application is locked or unlocked for editing.",+ "managedFrom": "External location the source application is managed from, when it is locked.",+ },+ },+ "data_catalog": {+ "description": "The data catalog: one row per event or entity schema version, with links to related catalog items.",+ "docs_url": "https://console.snowplowanalytics.com/api/msc/v1/docs/",+ "columns": {+ "name": "Name of the schema.",+ "vendor": "Vendor of the schema (e.g. com.acme).",+ "version": "Version of the schema (e.g. 1-0-0).",+ "format": "Schema format (jsonschema).",+ "itemType": "Whether the item is an EVENT or an ENTITY.",+ "links": "Schema keys of the catalog items this item links to.",+ },+ },"job_runs": {"description": "Executions of data modeling jobs. Snowplow retains only about the preceding week of run history.","docs_url": "https://docs.snowplow.io/docs/modeling-your-data/running-data-models-via-snowplow-bdp/retrieving-job-execution-data-via-the-api/",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/snowplow/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/snowplow/settings.pyindex 4a8d68ef0316..fef7c94945c3 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/snowplow/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/snowplow/settings.py@@ -61,6 +61,33 @@ SNOWPLOW_ENDPOINTS: dict[str, SnowplowEndpointConfig] = {path="/data-structures/v1",primary_keys=["hash"],),+ "data_products": SnowplowEndpointConfig(+ name="data_products",+ path="/data-products/v2",+ primary_keys=["id"],+ partition_key="createdAt",+ data_key="data",+ ),+ "event_specs": SnowplowEndpointConfig(+ name="event_specs",+ path="/event-specs/v1",+ # The spec does not say whether the list returns one row per event specification or one+ # per version, so the version is part of the key.+ primary_keys=["id", "version"],+ data_key="data",+ ),+ "source_apps": SnowplowEndpointConfig(+ name="source_apps",+ path="/source-apps/v1",+ primary_keys=["id"],+ data_key="data",+ ),+ "data_catalog": SnowplowEndpointConfig(+ name="data_catalog",+ path="/data-catalog/v1",+ # Catalog items have no id; the schema key plus the item type (EVENT or ENTITY) identifies one.+ primary_keys=["vendor", "name", "format", "version", "itemType"],+ ),"job_runs": SnowplowEndpointConfig(name="job_runs",path="/jobs/v1/runs",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/snowplow/snowplow.posthog-doc.mdx b/products/warehouse_sources/backend/temporal/data_imports/sources/snowplow/snowplow.posthog-doc.mdxindex ea0af706a672..5d1a4453cac5 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/snowplow/snowplow.posthog-doc.mdx+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/snowplow/snowplow.posthog-doc.mdx@@ -26,7 +26,8 @@ import AlphaRelease from '../_snippets/alpha-release.mdx'[Snowplow](https://snowplow.io/) is a behavioral data platform built around a customer-run event pipeline.This connector pulls the monitoring data from your Snowplow BDP Console — pipelines, failed-event metrics,-data modeling job runs and their steps, data structures, data models, and Console users — into the PostHog+data modeling job runs and their steps, data structures, the data catalog, data products, event specifications,+source applications, data models, and Console users — into the PostHogData warehouse so you can track pipeline health and modeling SLAs alongside your product data.It syncs the Console (management) API, not your Snowplow event stream itself — your enriched events alreadydiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/snowplow/tests/test_snowplow.py b/products/warehouse_sources/backend/temporal/data_imports/sources/snowplow/tests/test_snowplow.pyindex 928d780065fe..55e99ad82726 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/snowplow/tests/test_snowplow.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/snowplow/tests/test_snowplow.py@@ -230,10 +230,60 @@ class TestFailedEventMetricsFanOut:class TestListEndpoints:- def test_pipelines_unwraps_the_wrapper_object(self) -> None:- pipelines = [{"id": "p1", "name": "prod"}]- result = _run_endpoint("pipelines", _api(lambda path, request: {"pipelines": pipelines}))- assert result.rows == pipelines+ @parameterized.expand(+ [+ ("pipelines", "/pipelines/v1", "pipelines", {}),+ (+ "data_products",+ "/data-products/v2",+ "data",+ {"includes": {"owners": [{"id": "g1"}], "eventSpecs": [{"id": "es9"}]}, "errors": []},+ ),+ ("event_specs", "/event-specs/v1", "data", {"includes": [{"eventSpecId": "x1"}], "metadata": {}}),+ ("source_apps", "/source-apps/v1", "data", {}),+ ]+ )+ def test_unwraps_the_wrapper_object(+ self, endpoint: str, expected_path: str, data_key: str, siblings: dict[str, Any]+ ) -> None:+ rows = [{"id": "a1", "name": "first"}, {"id": "a2", "name": "second"}]+ result = _run_endpoint(endpoint, _api(lambda path, request: {**siblings, data_key: rows}))+ assert result.rows == rows+ assert _data_calls(result) == [(expected_path, {})]++ @parameterized.expand(+ [+ ("missing_key", "data_products", {"includes": {}}),+ ("null_list", "event_specs", {"data": None}),+ ("empty_list", "source_apps", {"data": []}),+ ("empty_bare_array", "data_catalog", []),+ ]+ )+ def test_empty_response_yields_no_rows(self, _name: str, endpoint: str, body: Any) -> None:+ result = _run_endpoint(endpoint, _api(lambda path, request: body))+ assert result.raised is None+ assert result.rows == []++ def test_data_catalog_yields_the_bare_array(self) -> None:+ items = [+ {+ "vendor": "com.example",+ "name": "checkout",+ "format": "jsonschema",+ "version": "1-0-0",+ "itemType": "EVENT",+ },+ {+ "vendor": "com.example",+ "name": "checkout",+ "format": "jsonschema",+ "version": "1-0-0",+ "itemType": "ENTITY",+ },+ ]+ result = _run_endpoint("data_catalog", _api(lambda path, request: items))+ assert result.rows == items+ assert _data_calls(result) == [("/data-catalog/v1", {})]def test_users_yields_the_bare_array(self) -> None:users = [{"id": "u1", "email": "[email protected]"}]@@ -328,6 +378,10 @@ class TestSourceResponse:("users", "asc", None, ["id"]),("data_models", "asc", None, ["name"]),("data_structures", "asc", None, ["hash"]),+ ("data_products", "asc", "createdAt", ["id"]),+ ("event_specs", "asc", None, ["id", "version"]),+ ("source_apps", "asc", None, ["id"]),+ ("data_catalog", "asc", None, ["vendor", "name", "format", "version", "itemType"]),("job_runs", "desc", "startTime", ["runId"]),("job_run_steps", "desc", "runStartTime", ["runId", "name"]),("failed_event_metrics", "desc", "window", ["pipelineId", "errorId", "window"]),