Skip to main content
Many teams keep raw data and transformed data in separate BigQuery projects. This guide creates a service account that can access multiple projects, then configures dbt™ to read sources from one project and write models to another.
Prerequisites
  • A Google Cloud account with administrative access.
  • Two or more Google Cloud projects with BigQuery enabled.

Create the service account

1

Create the account

In the Google Cloud Console, select your primary project, then go to IAM & Admin > Service Accounts and select Create service account. Name it (for example, bq-multi-project-sa) and select Create and continue.
2

Assign roles in the primary project

Add the BigQuery Data Editor and BigQuery Job User roles, then select Continue and Done.
3

Create and download a key

Open the service account, go to the Keys tab, select Add key > Create new key, choose JSON, and select Create. Store the downloaded key file securely; it grants access to your resources.
4

Grant access to additional projects

In each additional project, go to IAM & Admin > IAM, select Grant access, enter the service account email (bq-multi-project-sa@your-project-id.iam.gserviceaccount.com), and add the BigQuery Data Editor and BigQuery Job User roles. Repeat for every project the account needs.
The service account now appears in the IAM list of each project with the two BigQuery roles. Use its JSON key as the credentials for your BigQuery connection in Paradime.

Point dbt™ at source and target projects

With cross-project access in place, tell dbt™ which project to read from and which to write to. In BigQuery, the dbt™ database parameter is the project ID.

Reference external source projects

Set database on each source to the project that holds the raw data:

Control where models are written

Set database and schema in a model’s config block to write it to a specific project:

Set default destinations per folder

For larger projects, set default destinations by model folder in dbt_project.yml:
dbt_project.yml
The generate_database_name macro is standard dbt™ behavior: it uses the database you set in config, and otherwise falls back to your active target’s database.

Next steps

BigQuery integration

Connect BigQuery to Paradime and its authentication options.

Optional connection attributes

Add advanced profiles.yml attributes to a connection.