GCP.AnalyticsHub reference
DataExchange
Section titled “DataExchange”Source:
src/GCP/AnalyticsHub/DataExchange.ts
A BigQuery Analytics Hub data exchange — a container for listings that share datasets or Pub/Sub topics with subscribers.
Location and id are immutable. Display name, description, documentation, contact, discovery type, and email logging update in place. Switching between a default exchange and a data clean room replaces the exchange.
Data exchanges have no labels. Alchemy stamps
alchemy-stack / alchemy-stage / alchemy-id into the description
so list and pnpm nuke:gcp can identify owned exchanges.
DataExchange: Creating a Data Exchange
Section titled “DataExchange: Creating a Data Exchange”Generated id
const exchange = yield* GCP.AnalyticsHub.DataExchange("Marketplace", { displayName: "Marketplace", description: "shared datasets",});Named exchange with a contact
const exchange = yield* GCP.AnalyticsHub.DataExchange("Marketplace", { dataExchangeId: "marketplace", location: "us-central1", displayName: "Marketplace", primaryContact: "data@example.com",});DataExchange: Data Clean Rooms
Section titled “DataExchange: Data Clean Rooms”const dcr = yield* GCP.AnalyticsHub.DataExchange("CleanRoom", { displayName: "Clean Room", sharingEnvironmentConfig: { dcrExchangeConfig: {} },});DataExchangesListing
Section titled “DataExchangesListing”Source:
src/GCP/AnalyticsHub/DataExchangesListing.ts
An Analytics Hub listing published into a data exchange. Subscribers get a linked BigQuery dataset or a Pub/Sub subscription pointing at the shared source.
Parent exchange, location, listing id, and the source dataset/topic are immutable. Display name, description, documentation, contacts, categories, and export settings update in place.
Listings have no labels. Alchemy stamps ownership into the
description so list / pnpm nuke:gcp can find them.
DataExchangesListing: Creating a Listing
Section titled “DataExchangesListing: Creating a Listing”Share a BigQuery dataset
const dataset = yield* GCP.BigQuery.Dataset("Source", { location: "us-central1", forceDestroy: true,});const exchange = yield* GCP.AnalyticsHub.DataExchange("Marketplace", { displayName: "Marketplace",});const listing = yield* GCP.AnalyticsHub.DataExchangesListing("Orders", { dataExchange: exchange.name, displayName: "Orders", bigqueryDataset: { dataset: dataset.name },});Share a Pub/Sub topic
const listing = yield* GCP.AnalyticsHub.DataExchangesListing("Events", { dataExchange: exchange.name, displayName: "Events", pubsubTopic: { topic: topic.name },});DataExchangesQueryTemplate
Section titled “DataExchangesQueryTemplate”Source:
src/GCP/AnalyticsHub/DataExchangesQueryTemplate.ts
An Analytics Hub query template — a shared table-valued function defined by contributors in a data clean room.
Parent exchange, location, template id, and display name are
immutable. Description, documentation, contacts, and the routine
body update in place. Create the parent exchange with
sharingEnvironmentConfig: { dcrExchangeConfig: {} }.
Query templates have no labels. Alchemy stamps ownership into the
description so list / pnpm nuke:gcp can find them.
DataExchangesQueryTemplate: Creating a Query Template
Section titled “DataExchangesQueryTemplate: Creating a Query Template”const dcr = yield* GCP.AnalyticsHub.DataExchange("CleanRoom", { displayName: "Clean Room", sharingEnvironmentConfig: { dcrExchangeConfig: {} },});const template = yield* GCP.AnalyticsHub.DataExchangesQueryTemplate( "Counts", { dataExchange: dcr.name, displayName: "Counts", routine: { routineType: "TABLE_VALUED_FUNCTION", definitionBody: "SELECT 1 AS n", }, },);