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:- Octogen grants listing access. Octogen publishes the catalog as an Analytics Hub listing and grants your Google principal
roles/analyticshub.subscriberon that listing. - 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.
- Octogen observes the subscription. After the linked dataset exists, Octogen refreshes the subscription status to
active.
pending to awaiting_subscription.
Prerequisites
Ask Octogen to enable BigQuery listing access
Your Octogen contact must enable BigQuery listing access for your organization.
Choose a subscriber principal
Choose the Google principal that will create linked datasets. For automation, use a service account such as:
Install the Python SDK with the BigQuery extra
The SDK ships from the public This installs
octogen-dev repository and is managed with uv. Clone the repository and sync the sdks/python project with the bigquery extra:octogen-bq-subscribe, octogen-bq-autosubscribe, and octogen-mcp-login into the project environment. Confirm the install: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
Useoctogen-bq-subscribe when you already have a listing resource name and want to subscribe one catalog.
Get the listing resource
Use the Platform UI or the MCP
list_bigquery_listing_resources tool. A listing resource looks like:Apply
Manual CLI options
| Flag | Required | Default | Description |
|---|---|---|---|
--listing | Yes | — | Analytics Hub listing resource name. |
--project | Yes | — | Destination GCP project for the linked dataset. |
--dataset | No | Derived from the listing id | Linked dataset id. |
--location | No | Listing location | BigQuery dataset location. |
--friendly-name | No | Derived from the dataset id | Linked dataset display name. |
--apply | No | Off | Create the linked dataset. Without it, the command prints the plan only. |
--json | No | Off | Emit JSON output for automation. |
Automatic subscription from cron
Useoctogen-bq-autosubscribe when you want automation that polls for new BigQuery listings and subscribes to anything ready.
The command performs one idempotent sync pass:
- Lists BigQuery listings granted to your organization.
- Lists your registered BigQuery subscribers.
- Registers your Reader if it is missing.
- Subscribes every catalog whose status is
awaiting_subscription. - 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:
Dry run
Apply from cron
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
| Flag | Required | Default | Description |
|---|---|---|---|
--project | Yes | — | Destination GCP project for linked datasets. |
--principal | Yes | — | Google subscriber principal Octogen should grant. |
--catalog | No | All granted catalogs | Restrict the run to one catalog. Repeat for multiple catalogs. |
--friendly-name | No | Derived per dataset | Friendly name for created linked datasets. |
--apply | No | Off | Register and subscribe. Without it, the command reports what would happen. |
--json | No | Off | Emit JSON output. |
--mcp-url | No | https://mcp.octogen.ai/mcp/ | Octogen MCP endpoint. |
--mcp-client-id-file | No | OCTOGEN_MCP_CLIENT_ID_FILE | File containing the public OAuth client id from octogen-mcp-login. |
--mcp-refresh-token-file | No | OCTOGEN_MCP_REFRESH_TOKEN_FILE | File containing the rotating MCP refresh token. |
--mcp-token-command | No | OCTOGEN_MCP_TOKEN_COMMAND | Command that prints a short-lived MCP access token. |
--mcp-access-token | No | OCTOGEN_MCP_ACCESS_TOKEN | Short-lived MCP access token for manual runs. |
MCP tools behind the automation
Agents and custom clients can implement the same flow through MCP tools:| Tool | Purpose |
|---|---|
list_bigquery_listing_resources | Lists BigQuery listings granted to your organization. |
list_bigquery_subscribers | Lists registered subscriber projects, principals, and per-catalog status cells. |
register_bigquery_subscriber | Registers the GCP project and principal that should receive Analytics Hub subscriber access. |
refresh_bigquery_subscription_status | Checks whether a linked dataset subscription exists and updates the Octogen status. |
delete_bigquery_subscriber | Disables a registered subscriber. |
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.
Result statuses
octogen-bq-autosubscribe --json returns one catalog result per granted or requested catalog.
| Action | Meaning |
|---|---|
already_active | Octogen already sees an active linked dataset subscription. |
already_subscribed | BigQuery reported an existing linked dataset, and Octogen status was refreshed. |
subscribed | The command created a linked dataset and refreshed Octogen status. |
would_subscribe | Dry run: the catalog is ready and would be subscribed with --apply. |
pending | The Reader or listing grant is still being prepared, or Octogen has not observed status yet. |
skipped | The catalog is not ready or not enabled for this subscriber. |
error | The catalog needs attention or the subscribe/refresh step failed. |
Error handling
| Exit code | Command | Meaning |
|---|---|---|
0 | Both | Success, dry run, or idempotent no-op. |
1 | Both | Subscribe, MCP, or Google Cloud operation failed. |
2 | Both | Usage or invalid arguments. |
3 | octogen-bq-subscribe | Analytics Hub access is not granted yet. Retry shortly. |