Custom schemas and databses
Build assets in schemas and databases other than your target schema and database.
By default, all assets are built in the schema/dataset specified in the Branch environment. Each branch can be configured to write to its own schema and dataset.
Sometimes, it might be useful to build some assets in a different schema or database than the one specified in the Branch environment menu.
For example, you may want to build all your staging assets in a
staging schema, and all your
mart assets in a separate schema, while everything else is built in the default schema from the Branch environment menu.
This approach of using custom schemas and databases facilitates the segregation of assets into various schemas and databases. The naming convention for a custom schema combines the branch's schema with the custom schema name:
For instance, if you chose the branch assets to be published in the schema/dataset 'y42_main', and you want to build all staging assets in a staging schema named
staging, the resulting schema name will be
To assign a unique schema to an asset, utilize the
schema configuration key. This can be done in two ways:
- Assign to an individual model via a configuration block within that model.
- Set for a group of assets in a specific subdirectory through the
To define custom databases for certain assets, specify these in the
dbt_project.yml file or within the configuration block of an asset.