Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6715 improve documentation for dbt clean options #6716

Open
wants to merge 6 commits into
base: current
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

### dbt clean

Starting in v1.7, `dbt clean` will only clean paths within the current working directory. The `--no-clean-project-files-only` flag will delete all paths specified in the `clean-targets` section of `dbt_project.yml`, even if they're outside the dbt project.
Starting in v1.7, [dbt clean](/reference/commands/clean) will only clean paths within the current working directory. The `--no-clean-project-files-only` flag will delete all paths specified in the `clean-targets` section of `dbt_project.yml`, even if they're outside the dbt project.

Check warning on line 69 in website/docs/docs/dbt-versions/core-upgrade/08-upgrading-to-v1.7.md

View workflow job for this annotation

GitHub Actions / Vale linting

[vale] reported by reviewdog 🐶 [custom.Typos] Oops there's a typo -- did you really mean 'v1.7'? Raw Output: {"message": "[custom.Typos] Oops there's a typo -- did you really mean 'v1.7'? ", "location": {"path": "website/docs/docs/dbt-versions/core-upgrade/08-upgrading-to-v1.7.md", "range": {"start": {"line": 69, "column": 13}}}, "severity": "WARNING"}

Supported flags:
- `--clean-project-files-only` (default)
Expand Down
29 changes: 28 additions & 1 deletion website/docs/reference/commands/clean.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,33 @@
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) list in the `dbt_project.yml` file. It helps by removing unnecessary files or directories generated during the execution of other dbt commands, ensuring a clean state for the project.

## Example usage
```
dbt clean
```

## Supported flags
### --clean-project-files-only (default)

Check warning on line 15 in website/docs/reference/commands/clean.md

View workflow job for this annotation

GitHub Actions / Vale linting

[vale] reported by reviewdog 🐶 [custom.SentenceCaseHeaders] '--clean-project-files-only (default)' should use sentence-style capitalization. Try 'Clean project files only default' instead. Raw Output: {"message": "[custom.SentenceCaseHeaders] '--clean-project-files-only (default)' should use sentence-style capitalization. Try 'Clean project files only default' instead.", "location": {"path": "website/docs/reference/commands/clean.md", "range": {"start": {"line": 15, "column": 5}}}, "severity": "WARNING"}
Deletes all the paths within the project directory specified in `clean-targets`.

:::note
Avoid using paths outside the dbt project; otherwise, you will see an error.
:::


#### Example usage
```
$ dbt clean --clean-project-files-only
```

### --no-clean-project-files-only

Check warning on line 28 in website/docs/reference/commands/clean.md

View workflow job for this annotation

GitHub Actions / Vale linting

[vale] reported by reviewdog 🐶 [custom.SentenceCaseHeaders] '--no-clean-project-files-only' should use sentence-style capitalization. Try 'No clean project files only' instead. Raw Output: {"message": "[custom.SentenceCaseHeaders] '--no-clean-project-files-only' should use sentence-style capitalization. Try 'No clean project files only' instead.", "location": {"path": "website/docs/reference/commands/clean.md", "range": {"start": {"line": 28, "column": 5}}}, "severity": "WARNING"}
Deletes all the paths specified in the `clean-targets` list 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.
Loading