From ad216b5fd07b439c4399422f621cf762ff85cffc Mon Sep 17 00:00:00 2001 From: Eric Hauser Date: Sat, 19 Oct 2024 15:52:16 -0600 Subject: [PATCH 1/3] upgrade protobuf to >=5,<6 --- dbt_common/events/base_types.py | 7 +++++-- dbt_common/events/functions.py | 2 +- dbt_common/events/types_pb2.py | 18 ++++++++++++++---- pyproject.toml | 4 ++-- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/dbt_common/events/base_types.py b/dbt_common/events/base_types.py index 781b2a0e..2f11e4c7 100644 --- a/dbt_common/events/base_types.py +++ b/dbt_common/events/base_types.py @@ -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: diff --git a/dbt_common/events/functions.py b/dbt_common/events/functions.py index 4e055aa4..86d68237 100644 --- a/dbt_common/events/functions.py +++ b/dbt_common/events/functions.py @@ -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__ diff --git a/dbt_common/events/types_pb2.py b/dbt_common/events/types_pb2.py index 6574462e..1a3b91a5 100644 --- a/dbt_common/events/types_pb2.py +++ b/dbt_common/events/types_pb2.py @@ -1,12 +1,22 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: types.proto -# Protobuf Python Version: 4.25.2 +# Protobuf Python Version: 5.28.2 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion( + _runtime_version.Domain.PUBLIC, + 5, + 28, + 2, + '', + 'types.proto' +) # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -20,9 +30,9 @@ _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'types_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - DESCRIPTOR._options = None - _globals['_EVENTINFO_EXTRAENTRY']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + DESCRIPTOR._loaded_options = None + _globals['_EVENTINFO_EXTRAENTRY']._loaded_options = None _globals['_EVENTINFO_EXTRAENTRY']._serialized_options = b'8\001' _globals['_EVENTINFO']._serialized_start=62 _globals['_EVENTINFO']._serialized_end=335 diff --git a/pyproject.toml b/pyproject.toml index 0a601051..5fa7fdd9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", @@ -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" From 991dac857c181cc8c541db8a15be84fe4c156b80 Mon Sep 17 00:00:00 2001 From: Gerda Shank Date: Tue, 12 Nov 2024 10:02:23 -0500 Subject: [PATCH 2/3] Run 5.28.3 instead of 5.28.2 --- dbt_common/events/types_pb2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dbt_common/events/types_pb2.py b/dbt_common/events/types_pb2.py index 1a3b91a5..ed1d5c55 100644 --- a/dbt_common/events/types_pb2.py +++ b/dbt_common/events/types_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: types.proto -# Protobuf Python Version: 5.28.2 +# Protobuf Python Version: 5.28.3 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -13,7 +13,7 @@ _runtime_version.Domain.PUBLIC, 5, 28, - 2, + 3, '', 'types.proto' ) From 143dc67d83d0b8166f5973dbaa0a4ade46994a46 Mon Sep 17 00:00:00 2001 From: Gerda Shank Date: Tue, 12 Nov 2024 13:38:33 -0500 Subject: [PATCH 3/3] Changie --- .changes/unreleased/Under the Hood-20241112-133750.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Under the Hood-20241112-133750.yaml diff --git a/.changes/unreleased/Under the Hood-20241112-133750.yaml b/.changes/unreleased/Under the Hood-20241112-133750.yaml new file mode 100644 index 00000000..500dac38 --- /dev/null +++ b/.changes/unreleased/Under the Hood-20241112-133750.yaml @@ -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"