From ab783a4307a5f3cd4950bd900c6e3301c82670db Mon Sep 17 00:00:00 2001 From: Anks S <6273915+asarraf@users.noreply.github.com> Date: Tue, 24 Dec 2024 12:15:00 -0800 Subject: [PATCH] Ehanced the documentation for dbt clean --- website/docs/reference/commands/clean.md | 28 ++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/website/docs/reference/commands/clean.md b/website/docs/reference/commands/clean.md index 23a3f6080ce..23255e31cec 100644 --- a/website/docs/reference/commands/clean.md +++ b/website/docs/reference/commands/clean.md @@ -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.