Skip to content

Commit

Permalink
Upgrade protobuf to >=5.0,<6.0 (#219)
Browse files Browse the repository at this point in the history
* upgrade protobuf to >=5,<6

* Run 5.28.3 instead of 5.28.2

* Changie

---------

Co-authored-by: Eric Hauser <[email protected]>
  • Loading branch information
gshank and ewhauser authored Nov 19, 2024
1 parent 9bd1064 commit c82699d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Under the Hood-20241112-133750.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Under the Hood
body: Upgrade protobuf to <=5.0
time: 2024-11-12T13:37:50.886196-05:00
custom:
Author: gshank
Issue: "218"
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 c82699d

Please sign in to comment.