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

[CT-3391] [Regression] dbt clean fails with "directories outside the project" error #9089

Closed
2 tasks done
katieclaiborne opened this issue Nov 15, 2023 · 4 comments
Closed
2 tasks done
Labels
bug Something isn't working regression

Comments

@katieclaiborne
Copy link

katieclaiborne commented Nov 15, 2023

Is this a regression in a recent version of dbt-core?

  • I believe this is a regression in dbt-core functionality
  • I have searched the existing issues, and I could not find an existing issue for this regression

Current Behavior

After upgrading to dbt-core v1.7.1, dbt clean fails with a runtime error. (See log output below.)

Expected/Previous Behavior

In dbt-core v1.6.8, dbt clean executed smoothly, and I expected v1.7.1 to behave the same way.

19:02:25  Running with dbt=1.6.8
19:02:25  Checking target/*
19:02:25  Cleaned target/*
19:02:25  Checking dbt_packages/*
19:02:25  Cleaned dbt_packages/*
19:02:25  Finished cleaning all paths.

Steps To Reproduce

  1. Install dbt-core v1.7.1.
  2. Initialize a dbt project in the dbt directory of a GitHub repository.
  3. Set the DBT_PROJECT_DIR environment variable to "dbt"
  4. Add packages to a packages.yml file (see example below).
  5. From the root of the GitHub repo, execute dbt deps to install them.
  6. From the root of the GitHub repo, execute dbt clean to generate the runtime error.
packages:
  - package: dbt-labs/dbt_project_evaluator
    version: [">=0.8.0", "<0.9.0"]

Relevant log output

19:02:51  Running with dbt=1.7.1
19:02:51  Encountered an error:
Runtime Error
  dbt will not clean the following directories outside the project: ['/Users/katie.claiborne/github-repos/cbh-member-appts/dbt/target', '/Users/katie.claiborne/github-repos/cbh-member-appts/dbt/dbt_packages']

Environment

- OS: macOS-13.6.1-arm64-arm-64bit
- Python: 3.9.10
- dbt (working version): 1.6.8
- dbt (regression version): 1.7.1

Which database adapter are you using with dbt?

bigquery

Additional Context

Our project uses the default clean-targets config.

clean-targets:
  - "target"
  - "dbt_packages"
@katieclaiborne katieclaiborne added bug Something isn't working regression triage labels Nov 15, 2023
@github-actions github-actions bot changed the title [Regression] dbt clean fails with "directories outside the project" error [CT-3391] [Regression] dbt clean fails with "directories outside the project" error Nov 15, 2023
@MichelleArk
Copy link
Contributor

MichelleArk commented Nov 15, 2023

Thank you for opening this issue! I think this may have been intentionally introduced by #8469.

A workaround may be to run dbt clean --no-clean-project-files-only. Could you please give that a try @katieclaiborne?

❯ dbt clean --help
Usage: dbt clean [OPTIONS]

  Delete all folders in the clean-targets list (usually the dbt_packages and
  target directories.)

Options:
  ...
  --clean-project-files-only / --no-clean-project-files-only
                                  If disabled, dbt clean will delete all paths
                                  specified in clean-paths, even if they're
                                  outside the dbt project.
  ...

@katieclaiborne
Copy link
Author

Oh yes, that works!

(venv) CBM-FVFGRAA9Q05N:cbh-member-appts katie.claiborne$ dbt clean --no-clean-project-files-only
21:38:44  Running with dbt=1.7.1
21:38:44  Checking /Users/katie.claiborne/github-repos/cbh-member-appts/dbt/target/*
21:38:44  Cleaned /Users/katie.claiborne/github-repos/cbh-member-appts/dbt/target/*
21:38:44  Checking /Users/katie.claiborne/github-repos/cbh-member-appts/dbt/dbt_packages/*
21:38:44  Cleaned /Users/katie.claiborne/github-repos/cbh-member-appts/dbt/dbt_packages/*
21:38:44  Finished cleaning all paths.

@MichelleArk
Copy link
Contributor

Nice! We should probably add this to the 1.7 upgrade guide

@dbeatty10
Copy link
Contributor

Nice! We should probably add this to the 1.7 upgrade guide

Per @MichelleArk's comment, closing this in favor of adding this to the upgrade guide: dbt-labs/docs.getdbt.com#4482

Thanks again @katieclaiborne 🏆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression
Projects
None yet
Development

No branches or pull requests

3 participants