--exclude takes the same selectors as --select and removes what they match. It is the quickest way to skip a slow folder, a set of models that belong to another team, or models that are not ready yet.

Copy and paste

dbt build --exclude tag:finance                  # everything except the models tagged finance
dbt build --exclude path:models/marts/finance    # everything except one folder
dbt build --exclude marts.finance                # the same folder, by its place in the project
dbt build -s marts --exclude tag:finance         # one folder, minus a tag
dbt build --exclude tag:finance tag:slow         # several exclusions: anything matching either

Tag a model in its file:

{{ config(tags=['finance']) }}

Or a whole folder in dbt_project.yml:

models:
  shop:
    marts:
      finance:
        +tags: finance

Check what remains

dbt ls -s marts --exclude tag:finance --resource-type model
shop.marts.customer_orders
shop.marts.fct_orders
shop.marts.orders_daily
shop.marts.shipped_revenue

revenue_by_country, the only model tagged finance, is gone.

How exclusions behave

Save it as a selector

An exclusion you use every night belongs in selectors.yml, at the root of the project:

selectors:
  - name: nightly
    definition:
      union:
        - method: path
          value: models
        - exclude:
            - method: tag
              value: finance
dbt build --selector nightly

Tested with dbt Core 1.12.

References