dbt Schemas #
The primary schema definition happens in profiles.yml
:
<data store>: # such as BigQuery, Snowflaket, etc
target: <environment> # such as dev
outputs:
<environment>:
...
schema: <target schema>
Custom #
It’s often best practice to define custom schemas rather than taking the default schemas.
To define a custom schema, turn to models/<data path>/<data model>.sql
In ^, define the schema:
models:
<model name>:
example:
materialized: view
+schema: <schema name>
A common schema is staging
, which sits right on top of the raw data.
dbt run
will go through building out the schema, which defaults to creating <target schema>_<custom schema>
. This can be changed by adding custom dbt macros.