Skip to main content

Connecting BigQuery to Bicycle

Connect to Google BigQuery for cloud data warehousing and analytics. Bicycle reads BigQuery tables as SIGNAL sources for metrics, events, and dashboards.

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
  • Access to the BigQuery datasets and tables Bicycle should read
  • Permission in Google Cloud to create or manage a service account and grant IAM roles
ItemDescription
Project IDThe Google Cloud project that contains the target BigQuery datasets
Dataset (optional)Limit discovery to one dataset; omit to discover all datasets visible to the service account
Table Pattern (optional)Regex used to filter table names during discovery
AuthenticationService 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

  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.

Grant BigQuery roles

Grant the service account the least access required for the datasets Bicycle should read.

RoleRequiredPurpose
BigQuery Data Viewer (roles/bigquery.dataViewer)YesRead dataset metadata and table data
BigQuery Job User (roles/bigquery.jobUser)YesRun BigQuery jobs in the project
BigQuery Metadata Viewer (roles/bigquery.metadataViewer)RecommendedList datasets and table metadata during connection testing and discovery
BigQuery Read Session User (roles/bigquery.readSessionUser)OptionalUse the BigQuery Storage Read API when available
note

For least privilege, grant BigQuery Data Viewer on only the datasets Bicycle should read. BigQuery Job User and BigQuery Metadata Viewer are usually granted at the project level because Bicycle validates the connection by listing datasets in the project.

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 store it securely.

Select JSON as the private key type

Private key saved confirmation

warning

The service account JSON key can access BigQuery as the service account. Keep it in your organization's secrets manager, rotate it according to your security policy, and redact it from screenshots.


Setup in Bicycle

Step 1: Open Connectors and select BigQuery

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

Navigate to the BigQuery connector

Step 2: 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

Step 3: Add BigQuery connection details

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

FieldRequiredDescription
Project IDYesGoogle Cloud project ID for the BigQuery project Bicycle should query
DatasetNoDataset to discover. If omitted, Bicycle discovers all datasets the service account can list in the project
Table PatternNoRegex used to filter discovered table names, for example orders_.*
Service Account JSONYesFull contents of the downloaded JSON key file
Key IDNoNon-sensitive key identifier from the JSON key
Service Account EmailNoService account email, such as bicycle-bigquery-reader@project.iam.gserviceaccount.com
Service Account Project IDNoProject 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

Step 4: Test the connection

Click Test connection. Bicycle validates the service account JSON and confirms it can list datasets in the configured project. When the test succeeds, you will see Ready to add this connection.

BigQuery connection test succeeded

Step 5: 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


Discovery and stream setup

Bicycle discovers tables from the configured BigQuery project:

  • If Dataset is empty, Bicycle lists all datasets visible to the service account.
  • If Dataset is set, Bicycle discovers tables from only that dataset.
  • If Table Pattern is set, Bicycle includes only table names that match the pattern.
  • Discovered streams are named as dataset/table.

When you configure a BigQuery stream, Bicycle requires a cursor field and a start time for incremental ingestion. The end time is optional.

Troubleshooting

If Test connection fails or no tables appear after connecting, 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 required IAM roles are granted. If the error mentions listing datasets, add BigQuery Metadata Viewer at the project level
Connection succeeds but no tables are discoveredMissing dataset permissions, wrong dataset name, or Table Pattern filters out all tablesVerify the service account can list the dataset and tables, confirm the dataset name, and test the table pattern
Some datasets are missing when Dataset is emptyThe service account cannot list or read those datasetsGrant access on each dataset Bicycle should discover
tip

To verify access outside Bicycle, ask your Google Cloud administrator to impersonate the service account or use its key to list datasets and tables in the configured project.


Capabilities

CapabilityDescription
SIGNALRead data from BigQuery tables with incremental sync via a cursor field

What's next?

Now that BigQuery is connected, you can:

  • Discover and ingest tables from the configured project and dataset
  • Use the connection as a SIGNAL source for metrics, events, and dashboards
  • Configure streams with a cursor field and start time for incremental sync

References