Skip to main content

Connecting Google BigQuery to Bicycle

Learn how to create a service account, generate a private key, and connect your Google BigQuery project to Bicycle.

Requirements

To follow the steps in this guide, you'll need:

  • Permission to create connectors in Bicycle
  • A Google Cloud project with the BigQuery API enabled
  • A service account with the required BigQuery roles
  • A downloaded service account JSON key

Prepare BigQuery access

Create a dedicated service account for Bicycle. Do not use personal Google Cloud credentials for production connections.

Create a service account and grant access

  1. Go to the Google Cloud Console.
  2. Select the project that contains the BigQuery datasets Bicycle should read.
  3. Navigate to IAM & Admin > Service Accounts.
  4. Click Create service account.
  5. Give the service account a recognizable name, such as bicycle-bigquery-reader.
  6. Click Create and continue.
  7. Grant the service account the following roles:
    • BigQuery Data Viewer (roles/bigquery.dataViewer) on the datasets Bicycle should read
    • BigQuery Job User (roles/bigquery.jobUser) at the project level
  8. Click Done.

Grant BigQuery roles to the service account

Create a JSON key

  1. Open the service account.
  2. Go to Keys > Add key > Create new key.
  3. Select JSON, then click Create.
  4. Download the JSON key file and keep it secure.

Select JSON as the private key type

Private key saved confirmation


Setup in Bicycle

Open Connectors and select BigQuery

In Bicycle, go to Connectors. Under Recommended, find BigQuery and click + Connect.

Navigate to the BigQuery connector

Choose Service Account

Enter a connection name that identifies the environment, such as BigQuery Production. Select Service Account as the Connector method, then click Next.

Select Service Account as the connector method

Add BigQuery connection details

On the Add details step, fill in the BigQuery connection fields and paste the service account JSON key.

Project IDRequired

Google Cloud project ID for the BigQuery project Bicycle should query

Dataset

Dataset to discover. If omitted, Bicycle discovers all datasets the service account can list in the project

Table Pattern

Regex used to filter discovered table names, for example orders_.*

Service Account JSONRequired

Full contents of the downloaded JSON key file

Key ID

Non-sensitive key identifier from the JSON key

Service Account Email

Service account email, such as bicycle-bigquery-reader@project.iam.gserviceaccount.com

Service Account Project ID

Project ID from the service account JSON key

Example values:

  • Project ID: my-gcp-project
  • Dataset: analytics
  • Table Pattern: orders_.*
  • Service Account JSON: paste the full JSON key contents

Filled BigQuery connection form

Test the connection

Click Test connection. When the test succeeds, you will see Ready to add this connection.

BigQuery connection test succeeded

Add the connection

Click Add connection. When the connection is created successfully, you will see a confirmation with the connection name, ID, and method (Service Account). Click Close to return to the Connectors page.

BigQuery connection successfully added


Troubleshooting

If Test connection fails, check the following.

Error or symptomLikely causeFix
Service account key JSON is missingThe Service Account JSON field is emptyPaste the full JSON key contents from the service account key file
Project ID is requiredThe Project ID field is emptyEnter the Google Cloud project ID that contains the target BigQuery datasets
Failed to connect to BigQueryInvalid JSON key, disabled service account, missing BigQuery API, or insufficient IAM permissionsConfirm the key is valid, the service account is active, BigQuery is enabled, and the required roles are granted

References