Skip to content

Commit

Permalink
[Fix] respect project root when loading seeds (#8762)
Browse files Browse the repository at this point in the history
(cherry picked from commit 964e0e4)
  • Loading branch information
MichelleArk committed Oct 10, 2023
1 parent d224a82 commit 6a7dad5
Show file tree
Hide file tree
Showing 6 changed files with 728 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20231006-134551.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Enable seeds to be handled from stored manifest data
time: 2023-10-06T13:45:51.925546-04:00
custom:
Author: michelleark
Issue: "6875"
13 changes: 11 additions & 2 deletions core/dbt/context/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,9 +769,18 @@ def load_agate_table(self) -> agate.Table:
'can only load_agate_table for seeds (got a {})'
.format(self.model.resource_type)
)
path = os.path.join(
self.model.root_path, self.model.original_file_path

# include package_path for seeds defined in packages
package_path = (
os.path.join(self.config.packages_install_path, self.model.package_name)
if self.model.package_name != self.config.project_name
else "."
)
path = os.path.join(self.config.project_root, package_path, self.model.original_file_path)
if not os.path.exists(path):
assert self.model.root_path
path = os.path.join(self.model.root_path, self.model.original_file_path)

column_types = self.model.config.column_types
try:
table = agate_helper.from_csv(path, text_columns=column_types)
Expand Down
Loading

0 comments on commit 6a7dad5

Please sign in to comment.