Skip to content

Commit

Permalink
Debug log when type_code fails to convert to a data_type
Browse files Browse the repository at this point in the history
  • Loading branch information
dbeatty10 committed Mar 23, 2024
1 parent 59cb168 commit 40efcaf
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20240323-160251.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: Debug log when `type_code` fails to convert to a `data_type`
time: 2024-03-23T16:02:51.306658-06:00
custom:
Author: dbeatty10
Issue: "8912"
10 changes: 10 additions & 0 deletions dbt/adapters/events/adapter_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -515,3 +515,13 @@ message ConstraintNotSupportedMsg {
AdapterCommonEventInfo info = 1;
ConstraintNotSupported data = 2;
}

// E050
message TypeCodeNotFound {
int32 type_code = 1;
}

message TypeCodeNotFoundMsg {
AdapterCommonEventInfo info = 1;
TypeCodeNotFound data = 2;
}
9 changes: 9 additions & 0 deletions dbt/adapters/events/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,3 +421,12 @@ def message(self) -> str:
"be ignored. Set 'warn_unsupported: false' on this constraint to ignore this warning."
)
return line_wrap_message(warning_tag(msg))


class TypeCodeNotFound(DebugLevel):
def code(self) -> str:
return "E050"

def message(self) -> str:
msg = f"The `type_code` {self.type_code} was not recognized, which may affect error messages for enforced contracts that fail as well as `Column.data_type` values returned by `get_column_schema_from_query`"
return msg
1 change: 1 addition & 0 deletions tests/unit/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def test_event_codes(self):
types.FinishedRunningStats(stat_line="", execution="", execution_time=0),
types.ConstraintNotEnforced(constraint="", adapter=""),
types.ConstraintNotSupported(constraint="", adapter=""),
types.TypeCodeNotFound(type_code=0),
]


Expand Down

0 comments on commit 40efcaf

Please sign in to comment.