Skip to content

Commit

Permalink
Add unique_id to CompiledNode and ShowNode logging events (#7308)
Browse files Browse the repository at this point in the history
  • Loading branch information
gshank authored Apr 10, 2023
1 parent 7e1f04c commit f38d5ad
Show file tree
Hide file tree
Showing 6 changed files with 218 additions and 208 deletions.
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
Expand Up @@ -1780,6 +1780,7 @@ message ShowNode {
string preview = 2;
bool is_inline = 3;
string output_format = 4;
string unique_id = 5;
}

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

message CompiledNodeMsg {
Expand Down
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
Expand Up @@ -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,
)
)

Expand Down
1 change: 1 addition & 0 deletions core/dbt/task/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
)

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=""),
Expand Down

0 comments on commit f38d5ad

Please sign in to comment.