Indirect selection
Use the --indirect_selection
flag to dbt test
or dbt build
to configure which tests to run for the nodes you specify. You can set this as a CLI flag or an environment variable. In dbt Core, you can also configure user configurations in YAML selectors or in the flags:
block of dbt_project.yml
, which sets project-level flags.
When all flags are set, the order of precedence is as follows. Refer to About global configs for more details:
- CLI configurations
- Environment variables
- User configurations
You can set the flag to: empty
, buildable
, cautious
, or eager
(default). By default, dbt indirectly selects all tests if they touch any resource you select. Learn more about these options in Indirect selection in Test selection examples.
For example, you can run tests that only refer to selected nodes using a CLI configuration:
dbt test --indirect-selection cautious
Or you can run tests that only refer to selected nodes using an environment variable:
$ export DBT_INDIRECT_SELECTION=cautious
dbt run
You can also run tests that only refer to selected nodes using dbt_project.yml
project-level flags:
flags:
indirect_selection: cautious