: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 goldcast broadcasts, polls, ticket types and speakers tables (#109923)
Tom Owers98b6d5d21397
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 8d19dba74c9f..2791efb93276 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@@ -3711,12 +3711,12 @@ Today (7): `agenda_items`, `discussion_groups`, `event_members`, `events`, `orgaDiffed against: <https://apidocs.goldcast.io/>-- [ ] `event/broadcasts` — the live session objects under an event - sync-time joins for attendance and agenda analysis (high)-- [ ] `event/broadcasts/{id}/polls` — in-session poll results, the main engagement measurement in a webinar tool (high)-- [ ] `event/ticket-type` — lookup resolving the ticket type carried on event_members registrations (high)+- [x] `event/broadcasts` — the live session objects under an event - sync-time joins for attendance and agenda analysis (high)+- [x] `event/broadcasts/{id}/polls` — in-session poll results, the main engagement measurement in a webinar tool (high)+- [x] `event/ticket-type` — lookup resolving the ticket type carried on event_members registrations (high)- [ ] `core/tag-library` — lookup resolving tag IDs referenced across events and members (medium)- [ ] `event/booths` — sponsor/expo booths, the unit sponsorship ROI is measured on (medium)-- [ ] `event/{event_id}/public/v1/speakers` — speaker roster per event, a dimension for session performance breakdowns (medium)+- [x] `event/{event_id}/public/v1/speakers` — speaker roster per event, a dimension for session performance breakdowns (medium)- [ ] `event/{id}/get_recordings` — recording assets per event, needed to join on-demand viewing (medium)- [ ] `event/resources` — downloadable content attached to an event (low)- [ ] `event/sponsor-resources/{id}` — sponsor-supplied content assets (low)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/canonical_descriptions.pyindex 8b18bfeceb98..edb955dfb5c0 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/canonical_descriptions.py@@ -2,7 +2,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.canCanonicalDescriptions,)-_DOCS_URL = "https://customapi.goldcast.io/swagger-ui/"+_DOCS_URL = "https://apidocs.goldcast.io/"CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"organizations": {@@ -127,4 +127,74 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"updated_at": "Timestamp when the event member was last updated.",},},+ "broadcasts": {+ "description": "Broadcasts are the live sessions within an event — the stages attendees watch, with their schedule, live state, and engagement settings.",+ "docs_url": _DOCS_URL,+ "columns": {+ "id": "Unique identifier for the broadcast.",+ "event": "Id of the event this broadcast belongs to.",+ "title": "Title of the broadcast.",+ "description": "Description of the broadcast.",+ "broadcast_type": "Type of broadcast (live, external live stream, or hybrid).",+ "start_time": "Scheduled start time of the broadcast.",+ "end_time": "Scheduled end time of the broadcast.",+ "live_start_time": "Actual time the broadcast went live.",+ "live_end_time": "Actual time the broadcast ended.",+ "is_live": "Whether the broadcast is currently live.",+ "is_on_demand": "Whether the broadcast is available on demand.",+ "have_polls": "Whether polls are enabled for the broadcast.",+ "have_text_qna": "Whether text Q&A is enabled for the broadcast.",+ "have_video_qna": "Whether video Q&A is enabled for the broadcast.",+ "tags": "Tags attached to the broadcast.",+ "speakers": "Speakers assigned to the broadcast.",+ "created_at": "Timestamp when the broadcast was created.",+ "updated_at": "Timestamp when the broadcast was last updated.",+ },+ },+ "broadcast_polls": {+ "description": "Polls run during a broadcast, with their answer options. Fetched per broadcast, so `broadcast` identifies the parent broadcast.",+ "docs_url": _DOCS_URL,+ "columns": {+ "id": "Identifier of the poll.",+ "broadcast": "Id of the parent broadcast (injected during sync to make the row unique table-wide).",+ "text": "Question text of the poll.",+ "type": "Type of poll.",+ "status": "Current status of the poll.",+ "answers": "Answer options of the poll.",+ },+ },+ "ticket_types": {+ "description": "Ticket types defined for events, which control the tracks a registrant can access. Resolves the ticket type on event members.",+ "docs_url": _DOCS_URL,+ "columns": {+ "id": "Unique identifier for the ticket type.",+ "event": "Id of the event this ticket type belongs to.",+ "code": "Code of the ticket type.",+ "label": "Display label of the ticket type.",+ "member_count": "Number of event members holding this ticket type.",+ "allow_all_tracks": "Whether the ticket type grants access to every track in the event.",+ "allowed_tracks": "Tracks the ticket type grants access to.",+ "ticket_type_id": "Linked Vivenu ticket type id, if any.",+ "category_name": "Linked Vivenu ticket category name, if any.",+ "category_ref_id": "Linked Vivenu ticket category id, if any.",+ "created_at": "Timestamp when the ticket type was created.",+ "updated_at": "Timestamp when the ticket type was last updated.",+ },+ },+ "speakers": {+ "description": "Speakers listed on each event. Fetched per event, so `event` identifies the parent event.",+ "docs_url": _DOCS_URL,+ "columns": {+ "id": "Unique identifier for the speaker.",+ "event": "Id of the parent event (injected during sync to make the row unique table-wide).",+ "first_name": "First name of the speaker.",+ "last_name": "Last name of the speaker.",+ "title": "Job title of the speaker.",+ "company": "Company of the speaker.",+ "description": "Bio of the speaker.",+ "profile_picture_url": "URL of the speaker's profile picture.",+ "linkedin_url": "LinkedIn profile URL of the speaker.",+ "twitter_url": "Twitter profile URL of the speaker.",+ },+ },}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/goldcast.py b/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/goldcast.pyindex 81c09eda5a89..f7ba17e48093 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/goldcast.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/goldcast.py@@ -1,3 +1,4 @@+from collections.abc import Callablefrom typing import Anyfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.http import make_tracked_session@@ -25,9 +26,16 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.goldcast.sGOLDCAST_BASE_URL = "https://customapi.goldcast.io"-# The parent list every fan-out endpoint iterates over. Its rows only drive the per-event child-# requests; the `events` schema itself is synced by its own top-level resource.-_EVENTS_PARENT = "events"+# Broadcast rows carry live-stream and translation-session credentials. They have no analytics+# value and would otherwise land in the warehouse in plain text.+_BROADCAST_SECRET_FIELDS = (+ "medialive_rtmp_input_details",+ "youtube_stream_key",+ "facebook_stream_key",+ "custom_stream_key",+ "external_rtmp_push_stream",+ "wordly_session_key",+)def _headers() -> dict[str, str]:@@ -43,23 +51,34 @@ def _auth(access_key: str) -> ApiKeyAuthConfig:return {"type": "api_key", "api_key": f"Token {access_key}", "name": "Authorization", "location": "header"}-def _require_event_id(row: dict[str, Any]) -> dict[str, Any]:+def _require_id(parent_name: str) -> Callable[[dict[str, Any]], dict[str, Any]]:# `id` is the required fan-out key: a missing or falsy value must raise loudly rather than- # silently under-syncing that event's webinars/event_members with no signal in the logs.- event_id = row["id"]- if not event_id:- raise ValueError(f"Goldcast event is missing a valid id: {row}")+ # silently under-syncing that parent's children with no signal in the logs.+ def _check(row: dict[str, Any]) -> dict[str, Any]:+ parent_id = row["id"]+ if not parent_id:+ raise ValueError(f"Goldcast {parent_name} row is missing a valid id")+ return row++ return _check+++def _strip_broadcast_secrets(row: dict[str, Any]) -> dict[str, Any]:+ for key in _BROADCAST_SECRET_FIELDS:+ row.pop(key, None)return row-def _events_parent_resource() -> EndpointResource:+def _parent_resource(parent_name: str) -> EndpointResource:+ # The parent rows only drive the per-parent child requests; the parent schema itself is synced+ # by its own top-level resource.return {- "name": _EVENTS_PARENT,+ "name": parent_name,"endpoint": {- "path": GOLDCAST_ENDPOINTS["events"].path,+ "path": GOLDCAST_ENDPOINTS[parent_name].path,"paginator": SinglePagePaginator(),},- "data_map": _require_event_id,+ "data_map": _require_id(parent_name),}@@ -67,40 +86,43 @@ def _top_level_resource(config: GoldcastEndpointConfig) -> EndpointResource:# Collection endpoints return a bare JSON array; the organization endpoint returns a single# object, which the framework wraps as a one-row page. No data_selector, so a dict body is kept# as a single row exactly as the old normalization did.- return {+ resource: EndpointResource = {"name": config.name,"endpoint": {"path": config.path,"paginator": SinglePagePaginator(),},}+ if config.name == "broadcasts":+ resource["data_map"] = _strip_broadcast_secrets+ return resource-def _fan_out_resource(config: GoldcastEndpointConfig) -> EndpointResource:- # One request per event id. `{event}` is bound from the parent event's `id` — for `webinars` it- # sits in the URL path, for `event_members` in a query string carried on the path template. The- # event id is injected into each child row under `event` to form the composite primary key- # (child ids are only unique per parent); for `event_members`, which already carries a possibly- # stale `event`, this re-stamps it to the parent id.+def _fan_out_resource(config: GoldcastEndpointConfig, parent_name: str) -> EndpointResource:+ # One request per parent id. `{<parent_field>}` is bound from the parent's `id` — in the URL path+ # for most children, in a query string carried on the path template for `event_members`. The+ # parent id is injected into each child row under `parent_field` to form the composite primary+ # key (child ids are only unique per parent); for `event_members`, which already carries a+ # possibly stale `event`, this re-stamps it to the parent id.return {"name": config.name,"include_from_parent": ["id"],"endpoint": {"path": config.path,- "params": {"event": {"type": "resolve", "resource": _EVENTS_PARENT, "field": "id"}},+ "params": {config.parent_field: {"type": "resolve", "resource": parent_name, "field": "id"}},"paginator": SinglePagePaginator(),- # An event with no child resources (or one deleted between enumeration and this fetch)+ # A parent with no child resources (or one deleted between enumeration and this fetch)# can 404. Skip it rather than failing the whole sync; any other error still raises."response_actions": [{"status_code": 404, "action": "ignore"}],},- "data_map": rename_parent_fields(_EVENTS_PARENT, {"id": "event"}),+ "data_map": rename_parent_fields(parent_name, {"id": config.parent_field}),}def _resources_for(endpoint: str) -> list[str | EndpointResource]:config = GOLDCAST_ENDPOINTS[endpoint]- if config.fan_out_over_events:- return [_events_parent_resource(), _fan_out_resource(config)]+ if config.fan_out_parent:+ return [_parent_resource(config.fan_out_parent), _fan_out_resource(config, config.fan_out_parent)]return [_top_level_resource(config)]@@ -118,6 +140,9 @@ def goldcast_source("headers": _headers(),"auth": _auth(access_key),"paginator": SinglePagePaginator(),+ # Broadcast and webinar bodies carry stream keys under field names the name-based sample+ # scrubber doesn't recognise, so keep all Goldcast bodies out of HTTP sample capture.+ "capture": False,},"resource_defaults": {},"resources": _resources_for(endpoint),diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/settings.pyindex 870d929c2830..2ff168b8bbb6 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/settings.py@@ -2,28 +2,29 @@ from dataclasses import dataclass, fieldfrom typing import Optional-@dataclass+@dataclass(frozen=True)class GoldcastEndpointConfig:name: str- # Path relative to the Goldcast base URL. For fan-out endpoints this is a template with an- # `{event}` placeholder that is filled per parent event id.+ # Path relative to the Goldcast base URL. For fan-out endpoints this is a template with a+ # `{<parent_field>}` placeholder that is filled per parent id.path: strprimary_keys: list[str] = field(default_factory=lambda: ["id"])# Stable creation-time field to partition by. Left None when the endpoint exposes no such# field (never partition on `updated_at`, which rewrites partitions on every sync).partition_key: Optional[str] = None- # When True this is a per-event fan-out endpoint: iterate every event id from the events- # endpoint and request `path` once per event. `path` must contain an `{event}` placeholder.- fan_out_over_events: bool = False- # For fan-out children, the parent event id is written into each row under this key so the+ # When set this is a fan-out endpoint: iterate every id from this parent endpoint and request+ # `path` once per parent. `path` must contain a `{<parent_field>}` placeholder.+ fan_out_parent: Optional[str] = None+ # For fan-out children, the parent id is written into each row under this key so the# composite primary key is unique table-wide (child ids are only guaranteed unique per parent).- parent_event_field: str = "event"+ parent_field: str = "event"should_sync_default: bool = True-# Goldcast's public API exposes full collections with no pagination and no server-side-# modified-at/updated-at filter, so every endpoint is full refresh only. `agenda_items` carries no-# creation timestamp, so it is left unpartitioned; every other endpoint partitions on `created_at`.+# Goldcast list endpoints return the full collection as a bare array when no `limit` is sent, and+# expose no server-side modified-at/updated-at filter, so every endpoint is full refresh only. `agenda_items` carries no+# creation timestamp, nor do `broadcast_polls` and `speakers`, so those are left unpartitioned; every+# other endpoint partitions on `created_at`.GOLDCAST_ENDPOINTS: dict[str, GoldcastEndpointConfig] = {"organizations": GoldcastEndpointConfig(name="organizations",@@ -56,7 +57,7 @@ GOLDCAST_ENDPOINTS: dict[str, GoldcastEndpointConfig] = {path="/event/webinars/{event}/",primary_keys=["event", "id"],partition_key="created_at",- fan_out_over_events=True,+ fan_out_parent="events",),# Fan-out: one request per event id, passed as an `?event=` query param. Rows already carry an# `event` field; it is re-stamped defensively so the composite key is always populated.@@ -65,7 +66,34 @@ GOLDCAST_ENDPOINTS: dict[str, GoldcastEndpointConfig] = {path="/event/event-members/?event={event}",primary_keys=["event", "id"],partition_key="created_at",- fan_out_over_events=True,+ fan_out_parent="events",+ ),+ "broadcasts": GoldcastEndpointConfig(+ name="broadcasts",+ path="/event/broadcasts/",+ partition_key="created_at",+ ),+ # Fan-out: one request per broadcast id. Poll ids are not documented as globally unique, so the+ # parent broadcast id is injected under `broadcast` for the composite key.+ "broadcast_polls": GoldcastEndpointConfig(+ name="broadcast_polls",+ path="/event/broadcasts/{broadcast}/polls/",+ primary_keys=["broadcast", "id"],+ fan_out_parent="broadcasts",+ parent_field="broadcast",+ ),+ "ticket_types": GoldcastEndpointConfig(+ name="ticket_types",+ path="/event/ticket-type/",+ partition_key="created_at",+ ),+ # Fan-out: one request per event id. A speaker can appear on several events, so the parent event+ # id is part of the key.+ "speakers": GoldcastEndpointConfig(+ name="speakers",+ path="/event/{event}/public/v1/speakers/",+ primary_keys=["event", "id"],+ fan_out_parent="events",),}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/source.pyindex 5238b2f8ca67..0ced4ec5de25 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/source.py@@ -31,7 +31,7 @@ from products.warehouse_sources.backend.types import ExternalDataSourceType@SourceRegistry.registerclass GoldcastSource(SimpleSource[GoldcastSourceConfig]):lists_tables_without_credentials = True # static endpoint catalog — safe for public docs- api_docs_url = "https://customapi.goldcast.io/swagger-ui/"+ api_docs_url = "https://apidocs.goldcast.io/"@propertydef source_type(self) -> ExternalDataSourceType:diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/tests/test_goldcast.py b/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/tests/test_goldcast.pyindex 6769af9a73c0..50fdc706af79 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/tests/test_goldcast.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/goldcast/tests/test_goldcast.py@@ -73,6 +73,29 @@ class TestTopLevelEndpoints:_wire(MockSession.return_value, [_response([])])assert _rows("tok", "events") == []+ @mock.patch(CLIENT_SESSION_PATCH)+ def test_broadcasts_drop_stream_credentials(self, MockSession) -> None:+ _wire(+ MockSession.return_value,+ [+ _response(+ [+ {+ "id": "b1",+ "title": "Keynote",+ "youtube_stream_key": "yt-fake-key",+ "facebook_stream_key": "fb-fake-key",+ "custom_stream_key": "custom-fake-key",+ "external_rtmp_push_stream": "rtmp://stream.example.com/live/fake-key",+ "wordly_session_key": "wordly-fake-key",+ "medialive_rtmp_input_details": {"in_stream_key": "rtmp-fake-key"},+ }+ ]+ )+ ],+ )+ assert _rows("tok", "broadcasts") == [{"id": "b1", "title": "Keynote"}]+class TestFanOut:@mock.patch(CLIENT_SESSION_PATCH)@@ -94,11 +117,22 @@ class TestFanOut:{"id": "w3", "event": "e2"},]+ @parameterized.expand(+ [+ ("webinars", "/event/", "/event/webinars/p1/", "event"),+ ("speakers", "/event/", "/event/p1/public/v1/speakers/", "event"),+ ("broadcast_polls", "/event/broadcasts/", "/event/broadcasts/p1/polls/", "broadcast"),+ ]+ )@mock.patch(CLIENT_SESSION_PATCH)- def test_webinars_request_uses_event_in_path(self, MockSession) -> None:- snaps = _wire(MockSession.return_value, [_response([{"id": "e1"}]), _response([{"id": "w1"}])])- _rows("tok", "webinars")- assert snaps[1]["url"] == "https://customapi.goldcast.io/event/webinars/e1/"+ def test_child_request_binds_parent_id_and_stamps_it(+ self, endpoint: str, parent_path: str, child_path: str, parent_field: str, MockSession+ ) -> None:+ snaps = _wire(MockSession.return_value, [_response([{"id": "p1"}]), _response([{"id": "c1"}])])++ assert _rows("tok", endpoint) == [{"id": "c1", parent_field: "p1"}]+ assert snaps[0]["url"] == f"https://customapi.goldcast.io{parent_path}"+ assert snaps[1]["url"] == f"https://customapi.goldcast.io{child_path}"@mock.patch(CLIENT_SESSION_PATCH)def test_event_members_query_param_path_and_restamping(self, MockSession) -> None:@@ -164,7 +198,7 @@ class TestAuthAndRedaction:assert auth.api_key == "Token super-secret"@mock.patch(CLIENT_SESSION_PATCH)- def test_sync_session_registers_token_for_redaction(self, MockSession) -> None:+ def test_sync_session_redacts_token_and_skips_sample_capture(self, MockSession) -> None:# The token rides in the non-standard `Token` auth header the name-based scrubbers can't# recognise, so it must be registered for value-based redaction on the tracked session.MockSession.return_value.headers = {}@@ -174,6 +208,8 @@ class TestAuthAndRedaction:_rows("super-secret", "events")assert MockSession.call_args.kwargs.get("redact_values") == ("Token super-secret",)+ # Broadcast and webinar bodies carry stream keys the sample scrubber can't recognise.+ assert MockSession.call_args.kwargs.get("capture") is Falseclass TestSourceResponse: