BigQuery

Create a service account to connect BigQuery to Credible, and set a billing project and cost limits

To connect BigQuery to Credible, create a Google Cloud service account and download its JSON key.

Create a Service Account

  1. Go to the Google Cloud Console (opens in a new tab)
  2. Select your project
  3. Navigate to IAM & Admin > Service Accounts
  4. Click Create Service Account
  5. Enter a name (e.g., credible-bigquery)
  6. Click Create and Continue

Assign Permissions

Add these roles to the service account:

  • BigQuery Data Viewer, to read tables
  • BigQuery Job User, to run queries

If you need write access, use BigQuery Data Editor instead of Data Viewer.

To use BigQuery through a DuckDB connection, also add BigQuery Read Session User.

Click Continue, then Done.

Download the JSON Key

  1. Find your service account in the list and click on it
  2. Go to the Keys tab
  3. Click Add Key > Create new key
  4. Select JSON and click Create

The JSON key file downloads automatically. Keep it secure: it gives access to your BigQuery data.

Never commit JSON key files to version control.

Connect in Credible

  1. In the connection form, choose BigQuery
  2. Upload the JSON key file under Service Account
  3. Optionally, fill in the settings below
  4. Click Test Connection, then Connect

Optional Settings

SettingExampleWhat it does
Default Project IDmy-projectThe project for table names that don't name one. Defaults to the key's project
Billing Project IDmy-billing-projectThe project that runs and pays for queries, when it differs from the data's project. The service account needs BigQuery Job User there
LocationUS, EU, asia-northeast1Where queries run. Set it to your datasets' location
Maximum Bytes Billed1000000000BigQuery refuses any query that would bill more bytes than this. A guard against expensive queries
Query Timeout (ms)60000How long Credible waits for a query to finish

From the CLI

To add the connection with cred add connection, put an entry like this in the JSON file:

[
  {
    "name": "warehouse",
    "type": "bigquery",
    "bigqueryConnection": {
      "serviceAccountKeyJson": "{\"type\": \"service_account\", \"project_id\": \"my-project\", ...}",
      "defaultProjectId": "my-project",
      "location": "US"
    }
  }
]

serviceAccountKeyJson holds the whole key file as one string, with its quotes escaped. The optional settings are billingProjectId, maximumBytesBilled and queryTimeoutMilliseconds, all strings.

Troubleshooting

ProblemCauseFix
Access Denied: ... User does not have bigquery.jobs.create permissionThe service account lacks BigQuery Job User in the billing projectAdd the role, or set Billing Project ID to a project where it has it
Query exceeded limit for bytes billedThe query would scan more than Maximum Bytes BilledRaise the limit, or filter on a partition column so the query scans less
Not found: Dataset ... was not found in locationLocation does not match the dataset's locationSet Location to the dataset's location

Next Steps

On this page