database

Heads up!

This is a work in progress document. While this configuration applies to multiple resource types, the documentation has only been written for seeds.

Definition

Optionally specify a custom database for a model or seed. (To specify a database for a snapshot, use the target_database config).

When dbt creates a relation (table/view) in a database, it creates it as: {{ database }}.{{ schema }}.{{ identifier }}, e.g. analytics.finance.payments

The standard behavior of dbt is:

  • If a custom database is not specified, the database of the relation is the target database ({{ target.database }}).
  • If a custom database is specified, the database of the relation is the {{ database }} value.

To learn more about changing the way that dbt generates a relation's database, read Using Custom Databases

Changelog

Usage

Load seeds into the RAW database

dbt_project.yml
seeds:
+database: RAW

Warehouse specific information

  • BigQuery: project and database are interchangeable
  • Redshift: Cross-database queries are not possible in Redshift. As such, dbt will return a Database Error if you use this configuration.