Skip to main content

enabled

dbt_project.yml
models:
<resource-path>:
+enabled: true | false

models/<modelname>.sql

{{ config(
enabled=true | false
) }}

select ...


Definition

An optional configuration for enabling or disabling a resource.

  • 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):

  1. Add a model named segment_web_page_views (the same name) to your own project.
  2. 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
(Applies to dbt v2.0 and later)

Disable Semantic Layer resources from a package

Some packages may define Semantic Layer resources (semantic models, metrics, saved queries) using an older specification that isn’t compatible with the dbt Fusion engine.

To use these packages with Fusion while keeping your own semantic layer definitions, disable the package’s semantic layer resources in the relevant YAML file.

dbt_project.yml
# Disable the package's time spine model (if it conflicts with yours)
models:
ad_reporting:
semantic_models:
metricflow_time_spine:
+enabled: false

# Disable all semantic layer resources from the package
semantic-models:
ad_reporting:
+enabled: false

metrics:
ad_reporting:
+enabled: false

saved-queries:
ad_reporting:
+enabled: false

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

0
Loading