Skip to content

Commit

Permalink
fallback to existing model.root_path behaviour for seed loading
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleArk committed Oct 6, 2023
1 parent 0494a17 commit d316e77
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions core/dbt/context/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,9 @@ def load_agate_table(self) -> agate.Table:
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
delimiter = self.model.config.delimiter
Expand Down
1 change: 0 additions & 1 deletion core/dbt/contracts/graph/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,6 @@ 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
root_path: Optional[str] = None
depends_on: MacroDependsOn = field(default_factory=MacroDependsOn)
defer_relation: Optional[DeferRelation] = None
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/partial_parsing/test_partial_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ def rename_project_root(self, project, new_project_root):
rename_dir(project.project_root, new_project_root)
project.project_root = new_project_root
# flags.project_dir is set during the project test fixture, and is persisted across run_dbt calls,
# so it needs to be reset between
# so it needs to be reset between invocations
flags.set_from_args(Namespace(PROJECT_DIR=new_project_root), None)

@pytest.fixture(scope="class", autouse=True)
Expand Down

0 comments on commit d316e77

Please sign in to comment.