Skip to content

[CT-1886] Include adapter_response in RunResultMsg #6703

@jtcohen6

Description

@jtcohen6

adapter_response is being skipped during message serialization for execution results:

$ dbt --debug --log-format json run | jq .data.run_result.adapter_response
...
{}
...

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
return msg

Reproduction case

I drop a breakpoint in here:

fire_event(
NodeFinished(
node_info=runner.node.node_info,
run_result=result.to_msg(),
)
)

ipdb> result.adapter_response
{'_message': 'CREATE VIEW (0 processed)', 'code': 'CREATE VIEW', 'bytes_processed': 0, 'location': 'US', 'project_id': 'dbt-test-env', 'job_id': 'b70d9a54-38a6-4e21-ad07-d08e75ace428', 'slot_ms': 0}
ipdb> result.to_msg()
RunResultMsg(status='success', message='CREATE VIEW (0 processed)', timing_info=[TimingInfoMsg(name='compile', started_at=datetime.datetime(2023, 1, 24, 10, 38, 9, 423443), completed_at=datetime.datetime(2023, 1, 24, 10, 38, 9, 426940)), TimingInfoMsg(name='execute', started_at=datetime.datetime(2023, 1, 24, 10, 38, 9, 427426), completed_at=datetime.datetime(2023, 1, 24, 10, 38, 10, 391500))], thread='Thread-1 (worker)', execution_time=0.9696011543273926, adapter_response={}, num_failures=0)
ipdb> result.to_msg().adapter_response
{}

Previous behavior

This does represent a functional regression in v1.4, relative to v1.3, when we used different serialization (mashumaro) for the result:

$ dbt --debug --log-format json run | jq .data.run_result.adapter_response
...
{
  "_message": "CREATE VIEW (0 processed)",
  "bytes_processed": 0,
  "code": "CREATE VIEW",
  "job_id": "9180b859-944f-4f91-a559-d772e0697c6d",
  "location": "US",
  "project_id": "dbt-test-env",
  "slot_ms": 0
}
...

Same breakpoint as above:

ipdb> result.to_dict()['adapter_response']
{'_message': 'CREATE VIEW', 'code': 'CREATE VIEW', 'rows_affected': -1}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglogging

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions