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

Add unique_id to CompiledNode and ShowNode logging events #7308

Merged
merged 2 commits into from
Apr 10, 2023
Merged
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/Under the Hood-20230410-140228.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Under the Hood
body: Add unique_id to ShowNode and CompiledNode logging events
time: 2023-04-10T14:02:28.86602-04:00
custom:
Author: gshank
Issue: "7305"
2 changes: 2 additions & 0 deletions core/dbt/events/types.proto
Original file line number Diff line number Diff line change
@@ -1780,6 +1780,7 @@ message ShowNode {
string preview = 2;
bool is_inline = 3;
string output_format = 4;
string unique_id = 5;
}

message ShowNodeMsg {
@@ -1793,6 +1794,7 @@ message CompiledNode {
string compiled = 2;
bool is_inline = 3;
string output_format = 4;
string unique_id = 5;
}

message CompiledNodeMsg {
412 changes: 206 additions & 206 deletions core/dbt/events/types_pb2.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/dbt/task/compile.py
Original file line number Diff line number Diff line change
@@ -88,6 +88,7 @@ def task_end_messages(self, results):
compiled=result.node.compiled_code,
is_inline=is_inline,
output_format=output_format,
unique_id=result.node.unique_id,
)
)

1 change: 1 addition & 0 deletions core/dbt/task/show.py
Original file line number Diff line number Diff line change
@@ -81,6 +81,7 @@ def task_end_messages(self, results):
preview=output.getvalue(),
is_inline=is_inline,
output_format=self.args.output,
unique_id=result.node.unique_id,
)
)

4 changes: 2 additions & 2 deletions tests/unit/test_events.py
Original file line number Diff line number Diff line change
@@ -334,8 +334,8 @@ def test_event_codes(self):
types.CommandCompleted(
command="", success=True, elapsed=0.1, completed_at=get_json_string_utcnow()
),
types.ShowNode(node_name="", preview="", is_inline=True),
types.CompiledNode(node_name="", compiled="", is_inline=True),
types.ShowNode(node_name="", preview="", is_inline=True, unique_id="model.test.my_model"),
types.CompiledNode(node_name="", compiled="", is_inline=True, unique_id="model.test.my_model"),
# W - Node testing ======================
types.CatchableExceptionOnRun(exc=""),
types.InternalErrorOnRun(build_path="", exc=""),