GCP.AnalyticsHub reference
DataExchange
Section titled “DataExchange”Source:
packages/gcp/src/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: {} },});DataExchange: Looking up an existing data exchange
Section titled “DataExchange: Looking up an existing data exchange”DataExchange.lookup references a data exchange Alchemy doesn’t manage
(created in the console or by another stack). It is read during
plan/deploy, never created, updated or deleted, and binds like a declared
data exchange.
const dataExchange = GCP.AnalyticsHub.DataExchange.lookup({ dataExchangeId: "my-data-exchange",});DataExchangesListing
Section titled “DataExchangesListing”Source:
packages/gcp/src/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 },});DataExchangesListing: Looking up an existing data exchanges listing
Section titled “DataExchangesListing: Looking up an existing data exchanges listing”DataExchangesListing.lookup references a data exchanges listing Alchemy
doesn’t manage (created in the console or by another stack). It is read
during plan/deploy, never created, updated or deleted, and binds like a
declared data exchanges listing.
const dataExchangesListing = GCP.AnalyticsHub.DataExchangesListing.lookup({ listingId: "my-listing", dataExchange: "my-data-exchange",});DataExchangesQueryTemplate
Section titled “DataExchangesQueryTemplate”Source:
packages/gcp/src/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", }, },);DataExchangesQueryTemplate: Looking up an existing data exchanges query template
Section titled “DataExchangesQueryTemplate: Looking up an existing data exchanges query template”DataExchangesQueryTemplate.lookup references a data exchanges query
template Alchemy doesn’t manage (created in the console or by another
stack). It is read during plan/deploy, never created, updated or deleted,
and binds like a declared data exchanges query template.
const dataExchangesQueryTemplate = GCP.AnalyticsHub.DataExchangesQueryTemplate.lookup({ queryTemplateId: "my-query-template", dataExchange: "my-data-exchange",});