Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug log when type_code fails to convert to a data_type #135

Merged
merged 6 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
7 changes: 5 additions & 2 deletions dbt/adapters/events/adapter_types_pb2.py

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions dbt/adapters/events/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,3 +422,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:
dbeatty10 marked this conversation as resolved.
Show resolved Hide resolved
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
dbeatty10 marked this conversation as resolved.
Show resolved Hide resolved
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
Loading