Connect dbt to BigQuery so you can version-control, test, and deploy analytics code with modern engineering workflows.
dbt compiles your model .sql files into BigQuery-native SQL, executes them, and stores results in datasets you configure. You gain CI/CD, testing, documentation, and lineage on top of BigQuery’s serverless engine.
Give the service account BigQuery Data Editor on the target dataset, BigQuery Job User at the project level, and BigQuery Read Session User if you use Python materializations.Minimum roles keep security tight.
Add a profile with type: bigquery, method: service-account, project, dataset, threads, timeout_seconds, and keyfile path. Place profiles.yml in ~/.dbt or set DBT_PROFILES_DIR.
Create models/orders_summary.sql that selects order_id, customer_id, order_date, total_amount, joins Customers and aggregates OrderItems. Tag it as materialized = incremental.
Put CSVs in the /seeds folder—e.g., product_categories.csv. Run dbt seed to load into BigQuery.Version control keeps seed data auditable.
Run dbt run to build models, dbt test to execute assertions like accepted_values or relationships on Orders.customer_id → Customers.id.
Use Cloud Composer or Cloud Build to call dbt run with the --project-dir and --profiles-dir flags.Or deploy a Dagster/Airflow DAG that invokes the dbt CLI container.
Use incremental models for large fact tables, enable partition_by and cluster_by configs, keep datasets environment-scoped (dev, prod), and add column tests to catch schema drift early.
Check the BigQuery Job ID printed in the dbt log, open it in the console, and inspect slot usage or SQL compilation outputs in target/compiled.
.
dbt is compute-agnostic. Your project’s billing settings—on-demand slots or flat-rate—apply to the queries dbt submits.
Store the service-account JSON in a secret manager and mount it at build time, or pass credentials via environment variables supported by profiles.yml.
Yes. Set materialized='view' in model configs. dbt will create logical views that incur no storage cost and always read latest data.