clean-targets

dbt_project.yml
clean-targets: [directorypath]

Definition

Optionally specify a custom list of directories to be removed by the dbt clean command. As such, you should only include directories containing artifacts (e.g. compiled files, logs, installed packages) in this list.

Default

If this configuration is not included in your dbt_project.yml file, the clean command will remove files in your target-path.

Examples

Remove packages and compiled files as part of dbt clean

info

This is our preferred configuration

To remove packages as well as compiled files, include the value of your modules-path configuration in your clean-targets configuration.

dbt_project.yml
clean-targets:
- target
- dbt_modules

Now, run dbt clean.

Both the target and dbt_modules directory will be removed.

Note: this is the configuration in the dbt starter project, which is generated by the init command.

Remove logs when running dbt clean

dbt_project.yml
clean-targets: [target, dbt_modules, logs]