Using the + prefix
The +
prefix is a dbt syntax feature, introduced in dbt v0.17.0, which helps disambiguate between resource paths and configs in dbt_project.yml
files.
It is not compatible with dbt_project.yml
files that use config-version
1.
For example:
name: jaffle_shop
config-version: 2
...
models:
+materialized: view
jaffle_shop:
marts:
+materialized: table
Throughout this documentation, we've tried to be consistent in using the +
prefix in dbt_project.yml
files.
However, the leading +
is in fact only required when you need to disambiguate between resource paths and configs, for example when:
- A config accepts a dictionary as its inputs, for example, the
persist_docs
config. - Or, a config shares a key with part of a resource path, for example, if you had a directory of models named
tags
.
name: jaffle_shop
config-version: 2
...
models:
+persist_docs: # this config is a dictionary, so needs a + prefix
relation: true
columns: true
jaffle_shop:
schema: my_schema # a plus prefix is optional here
+tags: # this is the tag config
- "hello"
tags: # whereas this is the tag resource path
# The below config applies to models in the
# models/tags/ directory.
# Note: you don't _need_ a leading + here,
# but it wouldn't hurt.
materialized: view
When adding configs in dbt_project.yml
, it doesn't hurt to use the +
prefix, so we recommend you use it always.
Note: This use of the +
prefix, in dbt_project.yml
, is distinct from the use of +
to control config merge behavior (clobber vs. add) in other config settings (specific resource .yml
and .sql
files). Currently, the only config which supports +
for controlling config merge behavior is grants
.