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

Respect --project-dir in dbt clean command #2841

Merged
merged 4 commits into from
Oct 21, 2020

Conversation

feluelle
Copy link
Contributor

@feluelle feluelle commented Oct 19, 2020

resolves #2840

Description

To fix this issue I changed the code to move_to_nearest_project_dir before running the clean command. So it will clean the correct locations.

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt next" section.

@cla-bot
Copy link

cla-bot bot commented Oct 19, 2020

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, don't hesitate to ping @drewbanin.

CLA has not been signed by users: @feluelle

@jtcohen6
Copy link
Contributor

@cla-bot check

@cla-bot cla-bot bot added the cla:yes label Oct 19, 2020
@cla-bot
Copy link

cla-bot bot commented Oct 19, 2020

The cla-bot has been summoned, and re-checked this pull request!

Copy link
Contributor

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @feluelle! Could you add a changelog entry beneath v0.19.0 (either "under the hood" or a new "fixes" section), and add yourself to the list of contributors?

@@ -23,7 +24,8 @@
Contributors:
- [@joelluijmes](https:/joelluijmes) ([#2749](https:/fishtown-analytics/dbt/pull/2749), [#2821](https:/fishtown-analytics/dbt/pull/2821))
- [@kingfink](https:/kingfink) ([#2791](https:/fishtown-analytics/dbt/pull/2791))
- [@zmac12](https:/zmac12) ([#2871](https:/fishtown-analytics/dbt/pull/2817))
- [@zmac12](https:/zmac12) ([#2817](https:/fishtown-analytics/dbt/pull/2817))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtcohen6 There was a typo - 2871 instead of 2817.

@feluelle
Copy link
Contributor Author

feluelle commented Oct 20, 2020

Apart from the test I added, how can I manually check that the correct location will be cleaned. The thing is that it worked before for the current directory. So it didn't raise an error. I want to check that it removes the correct dirs and files.

@jtcohen6
Copy link
Contributor

jtcohen6 commented Oct 20, 2020

how can I manually check that the correct location will be cleaned

As in local testing? I think I understand what you mean: how to, as a step after running dbt clean in the test you added, confirm that the clean-paths have actually been cleaned. Could you use os.path.isdir(), and check for target, dbt_modules, etc?

@feluelle
Copy link
Contributor Author

Yes. (I don't know what I meant by manually :D) I will add that.

@feluelle
Copy link
Contributor Author

@jtcohen6 I added a test to ensure all directories specified in clean_targets were deleted by dbt clean.

Copy link
Contributor

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test looks great! Thanks for the contribution @feluelle

@jtcohen6 jtcohen6 merged commit ecadc74 into dbt-labs:dev/kiyoshi-kuromiya Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dbt clean does not respect the project-dir if provided
2 participants