BigQuery guide¶
Install the BigQuery extra:
Or with uv:
Auth methods¶
BigQueryConfig supports four auth methods via auth_type.
Application Default Credentials¶
When auth_type is unset, the driver uses Google Application Default Credentials. Run gcloud auth application-default login to configure them locally, or set GOOGLE_APPLICATION_CREDENTIALS to a service account key file path.
from adbc_poolhouse import BigQueryConfig, create_pool
config = BigQueryConfig(project_id="my-gcp-project")
pool = create_pool(config)
JSON credential file¶
config = BigQueryConfig(
auth_type="json_credential_file",
auth_credentials_path="/keys/service_account.json",
project_id="my-gcp-project",
)
JSON credential string¶
Pass the key file contents directly as a string instead of a path:
Set BIGQUERY_AUTH_CREDENTIALS_PATH or supply the JSON string via your secrets manager before calling create_pool.
User authentication (OAuth)¶
config = BigQueryConfig(
auth_type="user_authentication",
auth_client_id="...",
auth_client_secret="...",
auth_refresh_token="...",
project_id="my-gcp-project",
)
Loading from environment variables¶
BigQueryConfig reads all fields from environment variables with the BIGQUERY_ prefix:
See also¶
- Configuration reference — env_prefix, pool tuning
- Consumer patterns — FastAPI and dbt examples