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 4 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
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 @@
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.
runleonarun marked this conversation as resolved.
Show resolved Hide resolved

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**
runleonarun marked this conversation as resolved.
Show resolved Hide resolved
```
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 that are specified in the `clean-targets` section.
runleonarun marked this conversation as resolved.
Show resolved Hide resolved

> **NOTE:** If the `clean-targets` section contains paths outside the DBT project, this command will lead to a _Runtime Error_ to indicate the same.
runleonarun marked this conversation as resolved.
Show resolved Hide resolved

**Usage:**
runleonarun marked this conversation as resolved.
Show resolved Hide resolved
```
$ dbt clean --clean-project-files-only
```

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

Check warning on line 25 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": 25, "column": 5}}}, "severity": "WARNING"}
Deletes all the paths specified in the `clean-targets` section of `dbt_project.yml`, including those outside the current DBT project.
runleonarun marked this conversation as resolved.
Show resolved Hide resolved

```
$ 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.
runleonarun marked this conversation as resolved.
Show resolved Hide resolved
Loading