-
Notifications
You must be signed in to change notification settings - Fork 98
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
fix: resolve DBT_PROFILES_DIR
correctly if relative path specified
#1573
base: master
Are you sure you want to change the base?
Conversation
WalkthroughThis pull request modifies the Changes
Assessment against linked issues
Possibly related PRs
Tip 🌐 Web search-backed reviews and chat
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
❌ Changes requested. Reviewed everything up to d3864a8 in 56 seconds
More details
- Looked at
13
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. dbt_core_integration.py:220
- Draft comment:
Nice fix. The unnecessary join with project_dir has been removed for relative DBT_PROFILES_DIR paths. Consider simplifying further by returning os.path.normpath(profiles_dir) directly, since os.path.join with a single argument is redundant. - Reason this comment was not posted:
Marked as duplicate.
Workflow ID: wflow_Dpk2RzYw2qB4JPf1
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
DBT_PROFILES_DIR
correctly if relative path specified
This change will break things for other people.For the extension the CWD is not obvously set, compared to CLI where there is clear concept of CWD. Becasue of that we went with choosing the project directory as the CWD. |
@diegoquintanav I am not sure how this resolves the original bug #1554 . Can you help explain? |
Hey thanks for checking this PR! This change affects only the scenario where DBT_PROFILES_DIR is set as an environment variable and is not an absolute path. I've pasted my original reply to the issue in the PR description if that helps. In what cases would you say it breaks behaviour for other people? |
In the code that is removed in this PR the path is relative to the project root. In your case it is to be defined, by the calling code (probably the first workspace root directory). All people that have setup a relative path from the project root would have an issue if we merge this. |
Overview
Problem
if
DBT_PROFILES_DIR
is set, thenvscode-dbt-power-user/dbt_core_integration.py
Line 220 in 5735fa6
is joining
project_dir
withprofiles_dir
. Ifproject_dir
is coming fromDBT_PROJECT_DIR
, and both paths are relative then this is effectively producing<DBT_PROJECT_DIR>/<DBT_PROFILES_DIR>
which may not exist.In my case, I have
and this method is returning
default_profiles_dir=my_project/my_project/my_profiles
The value of
project_dir
being passed is resolved as**/dbt_project.yml
as invscode-dbt-power-user/src/manifest/dbtWorkspaceFolder.ts
Line 90 in 5735fa6
see #1554 (comment) for the original reply
Closes #1554
Solution
Removing the unnecessary path join
Screenshot/Demo
A picture is worth a thousand words. Please highlight the changes if applicable.
How to test
Checklist
README.md
updated and added information about my changeImportant
Fixes path resolution in
default_profiles_dir()
by removing unnecessary path joining withproject_dir
whenDBT_PROFILES_DIR
is set.default_profiles_dir()
indbt_core_integration.py
by removing unnecessaryos.path.join
withproject_dir
whenDBT_PROFILES_DIR
is set.DBT_PROFILES_DIR
is used as is if it's an absolute path, or resolved correctly if relative.This description was created by
for d3864a8. It will automatically update as commits are pushed.
Summary by CodeRabbit