-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
Description
adapter_response is being skipped during message serialization for execution results:
$ dbt --debug --log-format json run | jq .data.run_result.adapter_response
...
{}
...dbt-core/core/dbt/contracts/results.py
Lines 132 to 142 in 7b464b8
| 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:
dbt-core/core/dbt/task/runnable.py
Lines 232 to 237 in 7b464b8
| 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}Reactions are currently unavailable