-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[#4554] Don't require a profile for dbt deps and clean commands #4610
Conversation
4d9f8c6
to
75bf0e0
Compare
75bf0e0
to
241f91e
Compare
Prior to this pull request for the dbt deps and clean commands we would attempt to load the profile and if it failed would mis-report an error and then proceed with an UnsetProfile. The code would also set 'send_anonymous_usage_stats' to False for cases where the profile failed to load, which meant that for this edge case we had a different default for that attribute. Since we refactored the UserConfig/flags code, having an 'unset' user config no longer makes sense. It also doesn't make a lot of sense to go to extra work to validate profiles (and issue incorrect error messages) when the profile isn't required for the command. This change simplifies the '_get_rendered_profile' code to use the UnsetProfile directly, and set the user_config separately. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment about a test location but otherwise looks good.
@use_profile('postgres') | ||
def test_postgres_clean_bad_profile(self): | ||
del os.environ['PROFILE_TEST_HOST'] | ||
self.run_dbt(["clean"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test doesn't really make sense to have here since it's for dbt clean
but since we're going to rearrange them all soon I'm not sure how much it matters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I realized that. But it needs exactly the same setup, so it felt like a waste to copy the same test to a different integration test directory. Rather than being in a dbt 'deps' command, maybe we need a test for "things that run without a profile", but like you said, I'd like to defer that to later reorganization.
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.0.latest 1.0.latest
# Navigate to the new working tree
cd .worktrees/backport-1.0.latest
# Create a new branch
git switch --create backport-4610-to-1.0.latest
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick --mainline 1 3032594b26aaafaf1003db513645660d0e7c89dc
# Push it to GitHub
git push --set-upstream origin backport-4610-to-1.0.latest
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.0.latest Then, create a pull request where the |
resolves #4554
Description
Changing a profile parsing exception from a CompilationException to a ParsingException caused a failure in the code that intended to trap the error.
Switch to not loading the profile when we don't need it, and remove code that incorrectly reported the nature of the error.
Checklist
CHANGELOG.md
and added information about my change