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 for dbt compile overwriting source files #10887

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20241018-150256.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Prevent dbt compile from overwriting files that are passed in as absolute paths
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't able to get an error with dbt compile, but I was with dbt seed and dbt build.

Suggested change
body: Prevent dbt compile from overwriting files that are passed in as absolute paths
body: Prevent `dbt seed` from overwriting files when `seed-path` contains an absolute path

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to update it if needed. Lmk after giving this a shot: #10886 (comment)

time: 2024-10-18T15:02:56.289808-07:00
custom:
Author: Myles1
Issue: "10886"
2 changes: 1 addition & 1 deletion core/dbt/contracts/graph/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
# This is called for both the "compiled" subdirectory of "target" and the "run" subdirectory
if os.path.basename(self.path) == os.path.basename(self.original_file_path):
# One-to-one relationship of nodes to files.
path = self.original_file_path
path = self.path

Check warning on line 254 in core/dbt/contracts/graph/nodes.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/contracts/graph/nodes.py#L254

Added line #L254 was not covered by tests
else:
# Many-to-one relationship of nodes to files.
path = os.path.join(self.original_file_path, self.path)
Expand Down
250 changes: 250 additions & 0 deletions index.html
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you restore the original index.html (assuming this was an accidental change)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops. Sure: dc370bf

Large diffs are not rendered by default.

Loading