Skip to main content
For analytical and bulk workloads, Octogen can publish a granted catalog as a BigQuery Analytics Hub listing. Subscribing to the listing creates a linked dataset in your Google Cloud project, so you can query the full catalog with standard SQL while Octogen updates flow through automatically. Use BigQuery when you want to join Octogen catalog data against your own data, run large scans, or build analytics pipelines. Use the Catalog Search API or MCP for interactive product lookup and agent workflows.
BigQuery subscription uses your Google Cloud credentials and your destination GCP project. It does not use OCTO_API_KEY. The helper commands are part of the Python SDK’s optional bigquery extra.

How access works

BigQuery subscription is a two-party flow:
  1. Octogen grants listing access. Octogen publishes the catalog as an Analytics Hub listing and grants your Google principal roles/analyticshub.subscriber on that listing.
  2. You create the linked dataset. You run the subscription step from your own environment using Google Application Default Credentials. The linked dataset is created in your GCP project and billed to you.
  3. Octogen observes the subscription. After the linked dataset exists, Octogen refreshes the subscription status to active.
The grant is asynchronous. It can take a few minutes for a listing to move from pending to awaiting_subscription.

Prerequisites

1

Ask Octogen to enable BigQuery listing access

Your Octogen contact must enable BigQuery listing access for your organization.
2

Choose a subscriber principal

Choose the Google principal that will create linked datasets. For automation, use a service account such as:
serviceAccount:bq-reader@my-gcp-project.iam.gserviceaccount.com
3

Install the Python SDK with the BigQuery extra

The SDK ships from the public octogen-dev repository and is managed with uv. Clone the repository and sync the sdks/python project with the bigquery extra:
git clone https://github.com/octogen-ai/octogen-dev.git
cd octogen-dev
uv sync --project sdks/python --extra bigquery
This installs octogen-bq-subscribe, octogen-bq-autosubscribe, and octogen-mcp-login into the project environment. Confirm the install:
uv run --project sdks/python --extra bigquery octogen-bq-subscribe --help
4

Authenticate to Google Cloud

For local testing:
gcloud auth application-default login
In production, run with service account credentials that can create linked datasets in the destination project.
Run the octogen-bq-* and octogen-mcp-login commands below from the octogen-dev repository. Either activate the synced environment once with source sdks/python/.venv/bin/activate so the commands are on your PATH exactly as written, or prefix each one with uv run --project sdks/python --extra bigquery.

Manual subscription

Use octogen-bq-subscribe when you already have a listing resource name and want to subscribe one catalog.
1

Get the listing resource

Use the Platform UI or the MCP list_bigquery_listing_resources tool. A listing resource looks like:
projects/octogen-catalog-exchange/locations/US/dataExchanges/catalogs_prod/listings/catalog_farfetch_exported_product_view_v1
2

Preview the subscription

The command is a dry run by default.
octogen-bq-subscribe \
  --listing projects/octogen-catalog-exchange/locations/US/dataExchanges/catalogs_prod/listings/catalog_farfetch_exported_product_view_v1 \
  --project my-gcp-project
3

Apply

octogen-bq-subscribe \
  --listing projects/octogen-catalog-exchange/locations/US/dataExchanges/catalogs_prod/listings/catalog_farfetch_exported_product_view_v1 \
  --project my-gcp-project \
  --apply
Re-running is safe. If the linked dataset already exists, the command reports the existing subscription instead of creating a duplicate.
4

Query the linked dataset

SELECT *
FROM `my-gcp-project.octogen_catalog_farfetch_exported_product_view_v1.products_current_v1`
LIMIT 10;

Manual CLI options

FlagRequiredDefaultDescription
--listingYesAnalytics Hub listing resource name.
--projectYesDestination GCP project for the linked dataset.
--datasetNoDerived from the listing idLinked dataset id.
--locationNoListing locationBigQuery dataset location.
--friendly-nameNoDerived from the dataset idLinked dataset display name.
--applyNoOffCreate the linked dataset. Without it, the command prints the plan only.
--jsonNoOffEmit JSON output for automation.

Automatic subscription from cron

Use octogen-bq-autosubscribe when you want automation that polls for new BigQuery listings and subscribes to anything ready. The command performs one idempotent sync pass:
  1. Lists BigQuery listings granted to your organization.
  2. Lists your registered BigQuery subscribers.
  3. Registers your Reader if it is missing.
  4. Subscribes every catalog whose status is awaiting_subscription.
  5. Refreshes Octogen status after each linked dataset is created.

Bootstrap MCP OAuth credentials

octogen-bq-autosubscribe calls Octogen MCP to list and register subscriber state. Bootstrap MCP credentials once from an interactive terminal:
octogen-mcp-login \
  --client-id-file /secure/octogen-mcp.client-id \
  --redirect-uri-file /secure/octogen-mcp.redirect-uri \
  --refresh-token-file /secure/octogen-mcp.refresh
The login command opens Octogen AuthKit in your browser, registers a public MCP OAuth client if needed, requests an MCP-audience refresh token, and writes the client id, registered redirect URI, and rotating refresh token to the requested files. It does not print the refresh token.

Dry run

OCTOGEN_MCP_CLIENT_ID_FILE=/secure/octogen-mcp.client-id \
OCTOGEN_MCP_REFRESH_TOKEN_FILE=/secure/octogen-mcp.refresh \
octogen-bq-autosubscribe \
  --project my-gcp-project \
  --principal serviceAccount:bq-reader@my-gcp-project.iam.gserviceaccount.com \
  --json

Apply from cron

*/15 * * * * cd /path/to/octogen-dev && OCTOGEN_MCP_CLIENT_ID_FILE=/secure/octogen-mcp.client-id OCTOGEN_MCP_REFRESH_TOKEN_FILE=/secure/octogen-mcp.refresh uv run --project sdks/python --extra bigquery octogen-bq-autosubscribe --project my-gcp-project --principal serviceAccount:bq-reader@my-gcp-project.iam.gserviceaccount.com --apply --json
OCTOGEN_MCP_REFRESH_TOKEN_FILE should contain an Octogen MCP OAuth refresh token. If the identity provider rotates that refresh token during exchange, the command writes the replacement back to the same file while holding a sibling .lock file, so overlapping cron runs do not overwrite the same rotating token at once.

Autosubscribe options

FlagRequiredDefaultDescription
--projectYesDestination GCP project for linked datasets.
--principalYesGoogle subscriber principal Octogen should grant.
--catalogNoAll granted catalogsRestrict the run to one catalog. Repeat for multiple catalogs.
--friendly-nameNoDerived per datasetFriendly name for created linked datasets.
--applyNoOffRegister and subscribe. Without it, the command reports what would happen.
--jsonNoOffEmit JSON output.
--mcp-urlNohttps://mcp.octogen.ai/mcp/Octogen MCP endpoint.
--mcp-client-id-fileNoOCTOGEN_MCP_CLIENT_ID_FILEFile containing the public OAuth client id from octogen-mcp-login.
--mcp-refresh-token-fileNoOCTOGEN_MCP_REFRESH_TOKEN_FILEFile containing the rotating MCP refresh token.
--mcp-token-commandNoOCTOGEN_MCP_TOKEN_COMMANDCommand that prints a short-lived MCP access token.
--mcp-access-tokenNoOCTOGEN_MCP_ACCESS_TOKENShort-lived MCP access token for manual runs.

MCP tools behind the automation

Agents and custom clients can implement the same flow through MCP tools:
ToolPurpose
list_bigquery_listing_resourcesLists BigQuery listings granted to your organization.
list_bigquery_subscribersLists registered subscriber projects, principals, and per-catalog status cells.
register_bigquery_subscriberRegisters the GCP project and principal that should receive Analytics Hub subscriber access.
refresh_bigquery_subscription_statusChecks whether a linked dataset subscription exists and updates the Octogen status.
delete_bigquery_subscriberDisables a registered subscriber.
Most customers should use octogen-bq-autosubscribe instead of calling these tools directly. It handles idempotency, pending grants, existing subscriptions, and status refreshes for you.

Programmatic subscription

subscribe_to_listing is a synchronous Python helper that talks to Google Cloud using Application Default Credentials.
from octogen_ai_sdk import (
    OctogenBigQueryAccessPendingError,
    OctogenBigQueryError,
    subscribe_to_listing,
)

try:
    result = subscribe_to_listing(
        listing_resource="projects/octogen-catalog-exchange/locations/US/dataExchanges/catalogs_prod/listings/catalog_farfetch_exported_product_view_v1",
        destination_project="my-gcp-project",
    )
except OctogenBigQueryAccessPendingError:
    print("Access is not ready yet. Retry in a few minutes.")
    raise
except OctogenBigQueryError as exc:
    print(f"Subscribe failed: {exc}")
    raise

verb = "Already subscribed" if result.already_subscribed else "Subscribed"
print(f"{verb}: {result.linked_project}.{result.linked_dataset} [{result.state}]")
print(result.sample_query)

Result statuses

octogen-bq-autosubscribe --json returns one catalog result per granted or requested catalog.
ActionMeaning
already_activeOctogen already sees an active linked dataset subscription.
already_subscribedBigQuery reported an existing linked dataset, and Octogen status was refreshed.
subscribedThe command created a linked dataset and refreshed Octogen status.
would_subscribeDry run: the catalog is ready and would be subscribed with --apply.
pendingThe Reader or listing grant is still being prepared, or Octogen has not observed status yet.
skippedThe catalog is not ready or not enabled for this subscriber.
errorThe catalog needs attention or the subscribe/refresh step failed.

Error handling

Exit codeCommandMeaning
0BothSuccess, dry run, or idempotent no-op.
1BothSubscribe, MCP, or Google Cloud operation failed.
2BothUsage or invalid arguments.
3octogen-bq-subscribeAnalytics Hub access is not granted yet. Retry shortly.
Both commands are idempotent. Schedule octogen-bq-autosubscribe --apply as often as you need; completed catalogs report already_active and new ready catalogs are picked up automatically.