schema
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 schema for a model or seed. (To specify a schema for a snapshot, use the target_schema
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 schema is not specified, the schema of the relation is the target schema (
{{ target.schema }}
). - If a custom schema is specified, by default, the schema of the relation is
{{ target.schema }}_{{ schema }}
.
To learn more about changing the way that dbt generates a relation's schema
, read Using Custom Schemas
Usage
Models
Configure groups of models from the dbt_project.yml
file.
dbt_project.yml
models:jaffle_shop: # the name of a projectmarketing:+schema: marketing
Configure individual models using a config block:
models/my_model.sql
{{ config(schema='marketing') }}
Seeds
dbt_project.yml
seeds:+schema: mappings
Warehouse specific information
- BigQuery:
dataset
andschema
are interchangeable