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

update on_skip to adjust for node that do not have schema #10302

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all 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-20240612-124256.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Saved Query node fail during skip
time: 2024-06-12T12:42:56.329073-07:00
custom:
Author: ChenyuLInx
Issue: "10029"
2 changes: 1 addition & 1 deletion core/dbt/task/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ def _skip_caused_by_ephemeral_failure(self):
return self.skip_cause.node.is_ephemeral_model

def on_skip(self):
schema_name = self.node.schema
schema_name = getattr(self.node, "schema", "")
node_name = self.node.name

error_message = None
Expand Down
14 changes: 14 additions & 0 deletions tests/unit/task/test_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from dbt.contracts.graph.nodes import SavedQuery
from dbt.task.build import SavedQueryRunner


def test_saved_query_runner_on_skip(saved_query: SavedQuery):
runner = SavedQueryRunner(
config=None,
adapter=None,
node=saved_query,
node_index=None,
num_nodes=None,
)
# on_skip would work
runner.on_skip()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This would fail without change above

Loading