Skip to content
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

Merged
merged 9 commits into from
Oct 10, 2023
5 changes: 4 additions & 1 deletion core/dbt/context/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,10 @@
def load_agate_table(self) -> agate.Table:
if not isinstance(self.model, SeedNode):
raise LoadAgateTableNotSeedError(self.model.resource_type, node=self.model)
path = os.path.join(self.config.project_root, self.model.original_file_path)
assert self.model.root_path
path = os.path.join(

Check warning on line 866 in core/dbt/context/providers.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/context/providers.py#L866

Added line #L866 was not covered by tests
self.config.project_root, self.model.root_path, self.model.original_file_path
)
column_types = self.model.config.column_types
delimiter = self.model.config.delimiter
try:
Expand Down
4 changes: 3 additions & 1 deletion core/dbt/parser/seeds.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from os.path import relpath

from dbt.context.context_config import ContextConfig
from dbt.contracts.graph.nodes import SeedNode
from dbt.node_types import NodeType
Expand All @@ -8,7 +10,7 @@
class SeedParser(SimpleSQLParser[SeedNode]):
def parse_from_dict(self, dct, validate=True) -> SeedNode:
# seeds need the root_path because the contents are not loaded
dct["root_path"] = self.project.project_root
dct["root_path"] = relpath(self.project.project_root, self.root_project.project_root)

Check warning on line 13 in core/dbt/parser/seeds.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/parser/seeds.py#L13

Added line #L13 was not covered by tests
MichelleArk marked this conversation as resolved.
Show resolved Hide resolved
if "language" in dct:
del dct["language"]
# raw_code is not currently used, but it might be in the future
Expand Down
Loading