Skip to content

Commit

Permalink
upgrade protobuf to >=5,<6
Browse files Browse the repository at this point in the history
  • Loading branch information
ewhauser authored and gshank committed Nov 4, 2024
1 parent 65d7ba5 commit ad216b5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
7 changes: 5 additions & 2 deletions dbt_common/events/base_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,18 @@ def __getattr__(self, key):

def to_dict(self):
return MessageToDict(
self.pb_msg, preserving_proto_field_name=True, including_default_value_fields=True
self.pb_msg,
preserving_proto_field_name=True,
always_print_fields_with_no_presence=True,
)

def to_json(self) -> str:
return MessageToJson(
self.pb_msg,
preserving_proto_field_name=True,
including_default_value_fields=True,
always_print_fields_with_no_presence=True,
indent=None,
sort_keys=True,
)

def level_tag(self) -> EventLevel:
Expand Down
2 changes: 1 addition & 1 deletion dbt_common/events/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def msg_to_dict(msg: EventMsg) -> dict:
msg_dict = MessageToDict(
msg,
preserving_proto_field_name=True,
including_default_value_fields=True, # type: ignore
always_print_fields_with_no_presence=True,
)
except Exception as exc:
event_type = type(msg).__name__
Expand Down
18 changes: 14 additions & 4 deletions dbt_common/events/types_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies = [
"Jinja2>=3.1.3,<4",
"mashumaro[msgpack]>=3.9,<4.0",
"pathspec>=0.9,<0.13",
"protobuf>=4.0.0,<5.0.0",
"protobuf>=5.0,<6.0",
"python-dateutil>=2.0,<3.0",
"requests<3.0.0", # needs to match dbt-core
"typing-extensions>=4.4,<5.0",
Expand All @@ -51,7 +51,7 @@ lint = [
"pytest>=7.3,<8.0", # needed for linting tests
"types-Jinja2>=2.11,<3.0",
"types-jsonschema>=4.17,<5.0",
"types-protobuf>=4.24,<5.0",
"types-protobuf>=5.0,<6.0",
"types-python-dateutil>=2.8,<3.0",
"types-PyYAML>=6.0,<7.0",
"types-requests"
Expand Down

0 comments on commit ad216b5

Please sign in to comment.