Skip to content

Commit

Permalink
Ehanced the documentation for dbt clean
Browse files Browse the repository at this point in the history
  • Loading branch information
asarraf authored Dec 24, 2024
1 parent 7feed51 commit ab783a4
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions website/docs/reference/commands/clean.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,30 @@ sidebar_label: "clean"
id: "clean"
---

`dbt clean` is a utility function that deletes all folders specified in the [`clean-targets`](/reference/project-configs/clean-targets) list specified in `dbt_project.yml`. You can use this to delete the `dbt_packages` and `target` directories.
`dbt clean` is a utility function that deletes the paths specified within the [`clean-targets`](/reference/project-configs/clean-targets) section of the `dbt_project.yml` file. It helps to remove any unnecessary files or directories generated during the execution of other DBT commands, ensuring a clean state for the project.

To avoid complex permissions issues and potentially deleting crucial aspects of the remote file system without access to fix them, this command does not work when interfacing with the RPC server that powers the dbt Cloud IDE. Instead, when working in dbt Cloud, the `dbt deps` command cleans before it installs packages automatically. The `target` folder can be manually deleted from the sidebar file tree if needed.
**Usage**
```
dbt clean
```

## Supported flags
### --clean-project-files-only (default)
Deletes all the paths within the project directory that are specified in the `clean-targets` section.

> **NOTE:** If the `clean-targets` section contains paths outside the DBT project, this command will lead to a _Runtime Error_ to indicate the same.
**Usage:**
```
$ dbt clean --clean-project-files-only
```

### --no-clean-project-files-only
Deletes all the paths specified in the `clean-targets` section of `dbt_project.yml`, including those outside the current DBT project.

```
$ dbt clean --no-clean-project-files-only
```

## dbt clean with remote file system
To avoid complex permissions issues and potentially deleting crucial aspects of the remote file system without access to fix them, this command does not work when interfacing with the RPC server that powers the DBT Cloud IDE. Instead, when working in DBT Cloud, the `dbt deps` command cleans before it installs packages automatically. The `target` folder can be manually deleted from the sidebar file tree if needed.

0 comments on commit ab783a4

Please sign in to comment.