Skip to content

Commit

Permalink
CT 1886 include adapter_response in NodeFinished log message (#6709)
Browse files Browse the repository at this point in the history
* Include adapter_response in run_result in NodeFinished log event

* Changie

(cherry picked from commit e2ccf01)
  • Loading branch information
gshank authored and github-actions[bot] committed Jan 24, 2023
1 parent e61a39f commit 5fbb833
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20230124-115837.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Include adapter_response in NodeFinished run_result log event
time: 2023-01-24T11:58:37.74179-05:00
custom:
Author: gshank
Issue: "6703"
5 changes: 2 additions & 3 deletions core/dbt/contracts/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from dbt.events.proto_types import RunResultMsg, TimingInfoMsg
from dbt.events.contextvars import get_node_info
from dbt.logger import TimingProcessor
from dbt.utils import lowercase, cast_to_str, cast_to_int
from dbt.utils import lowercase, cast_to_str, cast_to_int, cast_dict_to_dict_of_strings
from dbt.dataclass_schema import dbtClassMixin, StrEnum

import agate
Expand Down Expand Up @@ -130,15 +130,14 @@ def __pre_deserialize__(cls, data):
return data

def to_msg(self):
# TODO: add more fields
msg = RunResultMsg()
msg.status = str(self.status)
msg.message = cast_to_str(self.message)
msg.thread = self.thread_id
msg.execution_time = self.execution_time
msg.num_failures = cast_to_int(self.failures)
msg.timing_info = [ti.to_msg() for ti in self.timing]
# adapter_response
msg.adapter_response = cast_dict_to_dict_of_strings(self.adapter_response)
return msg


Expand Down
1 change: 1 addition & 0 deletions tests/functional/logging/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def test_basic(project, logs_dir):
node_start = True
if log_event == "NodeFinished":
node_finished = True
assert log_data["run_result"]["adapter_response"]
if node_start and not node_finished:
if log_event == 'NodeExecuting':
assert "node_info" in log_data
Expand Down

0 comments on commit 5fbb833

Please sign in to comment.