Skip to main content

BigQuery

Let agents query and inspect your BigQuery datasets with a Google Cloud service account.

Connect it with: Service account. BigQuery's own documentation: https://cloud.google.com/bigquery/docs/authentication/service-account-file.

What agents can do​

Connect BigQuery so the agents working your tasks can reach it. With it connected, they can:

  • Run standard SQL queries to answer data questions, for example weekly active users or revenue by plan.
  • List datasets and tables and read their schemas before writing a query or a dbt model.
  • Estimate a query's cost with a dry run before running it.
  • Check that a scheduled load or transfer wrote today's partition.

Before you start​

  • A Google Cloud project with the BigQuery API enabled.
  • A service account for agents, granted BigQuery Job User on the project (to run queries) and BigQuery Data Viewer on the datasets they should read.
  • Permission to create a key for it. Some organizations block key creation with the iam.disableServiceAccountKeyCreation policy; an organization admin can make an exception for the project.
  • A Jaah account. Anyone can add a personal secret; an organization secret needs an Org Owner or Admin.

Connect with BigQuery​

Jaah connects to BigQuery with a service account, not with a sign-in button.

Connect with an API key​

Find each value first:

  • Service account key: Google Cloud console > IAM & Admin > Service Accounts > your account > Keys > Add key > Create new key > JSON; paste the whole downloaded file.
  • Project ID (optional): The project whose datasets agents query (the project picker at the top of the console shows its ID); blank uses the key's own project.

Then add it to Jaah:

  1. In Jaah, open Secrets, select New, and pick the BigQuery card.
  2. Name the secret and choose who can use it.
  3. Fill in Service account key, Project ID.
  4. Select Save. Jaah tests the secret straight away (see Test the connection).

Jaah encrypts what you type and never shows it again — not to you, and not to an admin.

Use your own OAuth app​

Not used: Jaah connects to BigQuery with a service account, not through an OAuth app.

Test the connection​

Select Test on the secret. Jaah makes one read-only call to BigQuery with the stored values and shows the result on the secret's page. Jaah also tests automatically when you save or reconnect.

Who can use it​

Every secret has an owner, and the owner decides who can use it:

  • Personal — only your own tasks can use it. This is the default.
  • Organization — every task in the organization can use it. Only Org Owners and Admins can choose this.
  • Attached to a project — every task on that project can use it, whoever started the task. See Attach a secret to a project.

More on owners and access: How secrets work.

Use it in an agent session​

An agent asks for the secret with its credential_get tool, by the secret's path, when it needs it, and gets the values for that one call. The path is the owner's prefix and the secret's name:

  • org/<name> for an organization secret,
  • projects/<project>/<name> for one attached to a project,
  • me/<name> for your personal one.

A key connection hands the agent its fields: service_account_json, project_id.

Tell the agent in your task description which secret to use, for example “use the BigQuery secret org/bigquery”.

Manage, rotate or disconnect​

Everything is on the secret's page under Secrets:

  • Rotate a key: create a new key at the vendor first, then select Replace on the secret and paste it. Revoke the old key at BigQuery once the test passes. Steps: Replace or delete a secret.
  • Disconnect: select Delete. The stored values are destroyed and agents lose access on their next call. To end access at BigQuery's side too, delete the service account's key in its cloud console.

Limitations​

  • Jaah tests with a read-only token and lists one dataset. It proves the key and project, not access to a given table.
  • Only service account keys are supported. Signing in with your own Google account, and keyless Workload Identity Federation, are not.
  • Queries are billed to the project the job runs in. Set a custom quota or a maximum bytes billed to cap what agents can spend.
  • In the community edition, which has no Google Cloud support, the Test is not available.
  • Agents can do only what the connected BigQuery service account and its roles allow.

Troubleshooting​

Test says Google refused: Invalid JWT Signature

The key was deleted or disabled. Create a new JSON key for the service account and select Replace on the secret.

Test says BigQuery rejected the service account key (403)

Grant the service account BigQuery Job User and BigQuery Data Viewer on the project in IAM & Admin > IAM, and check that the BigQuery API is enabled there. Google's own sentence after the dash names the missing permission.

Test says the key names no project

Fill in Project ID with the project whose datasets agents should query.

Still stuck? Select Test and read the result: it names the value BigQuery refused and the status it answered.

FAQ​

Can I query datasets in another project?

Yes. Set Project ID to that project and grant the service account access there. Jobs run in that project and are billed to it.

Does Jaah send my key to Google?

No. Jaah signs a short-lived request with the key and sends only that signature to Google's token service.

Can Jaah or an admin see the key or token?

No. Jaah stores it encrypted and never shows it again. Only the tasks allowed to use the secret receive it, at the moment they ask for it.

Can I connect more than one BigQuery account?

Yes. Add one secret per account, each with its own name, and tell the agent which one to use.