enabled
- Models
- Seeds
- Snapshots
- Tests
- Sources
- Metrics
- Exposures
models/<modelname>.sql
{{ config(
enabled=true | false
) }}
select ...
dbt_project.yml
models:
<resource-path>:
+enabled: true | false
dbt_project.yml
seeds:
<resource-path>:
+enabled: true | false
snapshots/<filename>.sql
{% snapshot snapshot_name %}
{{ config(
enabled=true | false
) }}
select ...
{% endsnapshot %}
dbt_project.yml
snapshots:
<resource-path>:
+enabled: true | false
tests/<filename>.sql
{% test <testname>() %}
{{ config(
enabled=true | false
) }}
select ...
{% endtest %}
tests/<filename>.sql
{{ config(
enabled=true | false
) }}
dbt_project.yml
tests:
<resource-path>:
+enabled: true | false
dbt_project.yml
sources:
<resource-path>:
+enabled: true | false
Definition
An optional configuration for disabling models, seeds, snapshots, and tests.
- Default: true
When a resource is disabled, dbt will not consider it as part of your project. Note that this can cause compilation errors.
If you instead want to exclude a model from a particular run, consider using the --exclude
parameter as part of the model selection syntax
If you are disabling models because they are no longer being used, but you want to version control their SQL, consider making them an analysis instead.
Examples
Disable a model in a package in order to use your own version of the model.
This could be useful if you want to change the logic of a model in a package. For example, if you need to change the logic in the segment_web_page_views
from the segment
package (original model):
- Add a model named
segment_web_page_views
the same name to your own project. - To avoid a compilation error due to duplicate models, disable the segment package's version of the model like so:
dbt_project.yml
models:
segment:
base:
segment_web_page_views:
+enabled: false
0