In order to connect Google BigQuery to Cube, you need to provide service account credentials. Cube requires the service account to have BigQuery Data Viewer and BigQuery Job User roles enabled. You can learn more about acquiring Google BigQuery credentials here.
- The Google Cloud Project ID for the BigQuery project
- A set of Google Cloud service credentialswhich allow access to the BigQuery project
- The Google Cloud region for the BigQuery project
Add the following to a
.env file in your Cube project:
CUBEJS_DB_TYPE=bigquery CUBEJS_DB_BQ_PROJECT_ID=my-bigquery-project-12345 CUBEJS_DB_BQ_KEY_FILE=/path/to/my/keyfile.json
You could also encode the key file using Base64 and set the result to
CUBEJS_DB_BQ_CREDENTIALS=$(cat /path/to/my/keyfile.json | base64)
|Environment Variable||Description||Possible Values||Required||Supports multiple data sources?|
|The Google BigQuery project ID to connect to||A valid Google BigQuery Project ID||✅||✅|
|The path to a JSON key file for connecting to Google BigQuery||A valid Google BigQuery JSON key file||✅||✅|
|A Base64 encoded JSON key file for connecting to Google BigQuery||A valid Google BigQuery JSON key file encoded as a Base64 string||❌||✅|
|The Google BigQuery dataset location to connect to. Required if used with pre-aggregations outside of US. If not set then BQ driver will fail with ||A valid Google BigQuery regional location||⚠️||✅|
|The name of a bucket in cloud storage||A valid bucket name from cloud storage||❌||✅|
|The cloud provider where the bucket is hosted||❌||✅|
|The number of concurrent connections each queue has to the database. Default is ||A valid number||❌||❌|
|The maximum number of concurrent database connections to pool. Default is ||A valid number||❌||✅|
Measures of type
countDistinctApprox can be
used in pre-aggregations when using Google BigQuery as a source database. To
learn more about Google BigQuery's support for approximate aggregate functions,
To learn more about pre-aggregation build strategies, head here.
|Feature||Works with read-only mode?||Is default?|
By default, Google BigQuery uses batching to build pre-aggregations.
No extra configuration is required to configure batching for Google BigQuery.
BigQuery only supports using Google Cloud Storage for export buckets.
Google Cloud Storage
For improved pre-aggregation performance with large datasets, enable export bucket functionality by configuring Cube with the following environment variables:
When using an export bucket, remember to assign the BigQuery Data Editor and Storage Object Admin role to your BigQuery service account.
Cube does not require any additional configuration to enable SSL as Google BigQuery connections are made over HTTPS.
Did you find this page useful?