Connect BigQuery

BigQuery metadata checks, schema, and row counts

BigQuery is on every plan, including Free. The table limit for the plan still applies. Prices on the pricing page are in US dollars.

Paste a service-account JSON key on Connections. Row Monitor checks the key shape, tests the dataset, then encrypts the key. The key is not shown again. To change it, paste a new key. Deleting the connection, or closing the account that owns the workspace, deletes the saved key.

What a check reads

Every check below uses the BigQuery metadata API. None of them read table rows.

  • Test connection: datasets.get (metadata only)
  • List tables: tables.list (metadata only)
  • Schema: tables.get schema (metadata only)
  • Volume: tables.get numRows (metadata only)
  • Freshness: tables.get lastModifiedTime (metadata only)

Schema comes from the table resource. Volume is numRows. Freshness is lastModifiedTime, not the maximum of a timestamp column. numRows omits rows that are still in the streaming buffer.lastModifiedTime changes when the table data or its metadata changes. Nested fields are stored as the top-level field. Views are not listed, because they have no stored row count, and Row Monitor does not query them.

Roles

Grant this on the dataset (or on the project, which covers every dataset):

  • roles/bigquery.metadataViewer — BigQuery Metadata Viewer. It includes bigquery.datasets.get, bigquery.tables.get, and bigquery.tables.list.

Do not grant these. The checks do not use them.

  • roles/bigquery.jobUser — creates query jobs. Row Monitor does not run a query, including INFORMATION_SCHEMA and __TABLES__.
  • roles/bigquery.dataViewer — includes bigquery.tables.getData, which reads rows. No check calls that.

There is no SQL grant. BigQuery access is an IAM binding.

Cost

These calls are metadata reads. They do not start a query job and they do not scan table bytes, so they are not billed as analysis. That is why Job User and Data Viewer are not on the role list.

Console

  1. In Google Cloud, create a service account named rowmonitor. Skip the optional project-wide role if you will bind the dataset instead.
  2. Open BigQuery, then the dataset, then Sharing, then Permissions.
  3. Add the service account email. Choose the role BigQuery Metadata Viewer.
  4. On the service account, open Keys, then Add key, then JSON. Download happens once.
  5. In Row Monitor, open Connections, choose Add BigQuery, and paste the file contents. Set the project id and the dataset id.
  6. Use Test connection. If it succeeds, use Test and save. Delete the JSON file from the machine you downloaded it to.

gcloud

Replace PROJECT_ID. The project binding is wider than one dataset. Prefer the console steps when you can name one dataset.

gcloud iam service-accounts create rowmonitor --display-name="Row Monitor"

gcloud iam service-accounts keys create rowmonitor-key.json \
  --iam-account=rowmonitor@PROJECT_ID.iam.gserviceaccount.com

# Broader than a single dataset. The console steps below are the tighter grant.
gcloud projects add-iam-policy-binding PROJECT_ID \
  --member="serviceAccount:rowmonitor@PROJECT_ID.iam.gserviceaccount.com" \
  --role="roles/bigquery.metadataViewer"

Alert emails, Slack messages, and the times in the app use the workspace time zone. It starts as the browser's zone at signup. The owner can change it in Settings, and daylight saving is included. Airflow schedules are still evaluated the way Airflow defines them. The time zone does not change detection. Back to help