-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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] respect project root when loading seeds #8762
Conversation
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #8762 +/- ##
==========================================
- Coverage 86.62% 86.50% -0.13%
==========================================
Files 176 176
Lines 25772 25861 +89
==========================================
+ Hits 22325 22371 +46
- Misses 3447 3490 +43
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
core/dbt/contracts/graph/nodes.py
Outdated
@@ -875,6 +875,7 @@ class SeedNode(ParsedNode): # No SQLDefaults! | |||
config: SeedConfig = field(default_factory=SeedConfig) | |||
# seeds need the root_path because the contents are not loaded initially | |||
# and we need the root_path to load the seed later | |||
# TODO: remove root_path as it is unused, and instead computed dynamically in load_agate_table |
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.
What do you think of:
- remove
root_path
for v1.7 (manifest v11) - backport just the
load_agate_table
change to earlier versions
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.
Yep! This is what I was thinking as well. I left this as a TODO so this spike could be merged + backported as-is.
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.
I've opted to preserve the existing behaviour for getting the seed path that leverages root_path to mitigate risk of regression - so it's not quite in a state yet where this TODO makes sense as root_path is still used in load_agate_table
5ad4646
to
8e46d49
Compare
8e46d49
to
d316e77
Compare
5a8ba41
to
3b23a51
Compare
3b23a51
to
f778dec
Compare
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.6.latest 1.6.latest
# Navigate to the new working tree
cd .worktrees/backport-1.6.latest
# Create a new branch
git switch --create backport-8762-to-1.6.latest
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 964e0e4e8ad50a917074aabc8493b210a84e0258
# Push it to GitHub
git push --set-upstream origin backport-8762-to-1.6.latest
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.6.latest Then, create a pull request where the |
(cherry picked from commit 964e0e4)
(cherry picked from commit 964e0e4)
(cherry picked from commit 964e0e4)
(cherry picked from commit 964e0e4)
(cherry picked from commit 964e0e4)
(cherry picked from commit 964e0e4)
(cherry picked from commit 964e0e4)
(cherry picked from commit 964e0e4)
…#8804) (cherry picked from commit 964e0e4) Co-authored-by: Kshitij Aranke <[email protected]>
With the introduction of enabling partial parse in PR #904, upon testing the implementation, it is observed that the seeds files were not been able to be located as the partial parse file contained a stale `root_path` from previous command runs. This issue is observed on specific earlier versions of dbt-core like `1.5.4` and `1.6.5`, but not on recent versions of dbt-core `1.5.8`, `1.6.6` and `1.7.0`. I am suspecting that PR dbt-labs/dbt-core#8762 is likely the fix and the fix appears to be backported to later version releases of `1.5.x` and `1.6.x`. However, irrespective of the dbt-core version, this PR attempts to correct the `root_path` in the partial parse file by replacing it with the needed project directory where the project files are located. And thus ensures that the feature runs correctly for older and newer versions of dbt-core. closes: #937 --------- Co-authored-by: Tatiana Al-Chueyr <[email protected]>
With the introduction of enabling partial parse in PR astronomer#904, upon testing the implementation, it is observed that the seeds files were not been able to be located as the partial parse file contained a stale `root_path` from previous command runs. This issue is observed on specific earlier versions of dbt-core like `1.5.4` and `1.6.5`, but not on recent versions of dbt-core `1.5.8`, `1.6.6` and `1.7.0`. I am suspecting that PR dbt-labs/dbt-core#8762 is likely the fix and the fix appears to be backported to later version releases of `1.5.x` and `1.6.x`. However, irrespective of the dbt-core version, this PR attempts to correct the `root_path` in the partial parse file by replacing it with the needed project directory where the project files are located. And thus ensures that the feature runs correctly for older and newer versions of dbt-core. closes: astronomer#937 --------- Co-authored-by: Tatiana Al-Chueyr <[email protected]>
resolves #6875
Problem
dbt seed
fails when attempting to leverage partial parse file across dbt invocations in the same project, but different root directories.Solution
Use the project root instead of the root path on the model node (which could be from a prior dbt run in a different directory, but the same project) when loading seeds.
Risk assessment (for backporting):
Checklist