1 From f7c480139015cb8746f3fa751dc72b788d0ce8a0 Mon Sep 17 00:00:00 2001
2 From: Eric Hauser <ewhauser@gmail.com>
3 Date: Sat, 19 Oct 2024 15:52:16 -0600
4 Subject: [PATCH] upgrade protobuf to >=5,<6
7 dbt_common/events/base_types.py | 7 +++++--
8 dbt_common/events/functions.py | 2 +-
9 dbt_common/events/types_pb2.py | 18 ++++++++++++++----
10 pyproject.toml | 4 ++--
11 4 files changed, 22 insertions(+), 9 deletions(-)
13 diff --git a/dbt_common/events/base_types.py b/dbt_common/events/base_types.py
14 index 781b2a0e..2f11e4c7 100644
15 --- a/dbt_common/events/base_types.py
16 +++ b/dbt_common/events/base_types.py
17 @@ -91,15 +91,18 @@ def __getattr__(self, key):
21 - self.pb_msg, preserving_proto_field_name=True, including_default_value_fields=True
23 + preserving_proto_field_name=True,
24 + always_print_fields_with_no_presence=True,
27 def to_json(self) -> str:
30 preserving_proto_field_name=True,
31 - including_default_value_fields=True,
32 + always_print_fields_with_no_presence=True,
37 def level_tag(self) -> EventLevel:
38 diff --git a/dbt_common/events/functions.py b/dbt_common/events/functions.py
39 index 4e055aa4..86d68237 100644
40 --- a/dbt_common/events/functions.py
41 +++ b/dbt_common/events/functions.py
42 @@ -97,7 +97,7 @@ def msg_to_dict(msg: EventMsg) -> dict:
43 msg_dict = MessageToDict(
45 preserving_proto_field_name=True,
46 - including_default_value_fields=True, # type: ignore
47 + always_print_fields_with_no_presence=True,
49 except Exception as exc:
50 event_type = type(msg).__name__
51 diff --git a/dbt_common/events/types_pb2.py b/dbt_common/events/types_pb2.py
52 index 6574462e..1a3b91a5 100644
53 --- a/dbt_common/events/types_pb2.py
54 +++ b/dbt_common/events/types_pb2.py
56 # -*- coding: utf-8 -*-
57 # Generated by the protocol buffer compiler. DO NOT EDIT!
58 +# NO CHECKED-IN PROTOBUF GENCODE
60 -# Protobuf Python Version: 4.25.2
61 +# Protobuf Python Version: 5.28.2
62 """Generated protocol buffer code."""
63 from google.protobuf import descriptor as _descriptor
64 from google.protobuf import descriptor_pool as _descriptor_pool
65 +from google.protobuf import runtime_version as _runtime_version
66 from google.protobuf import symbol_database as _symbol_database
67 from google.protobuf.internal import builder as _builder
68 +_runtime_version.ValidateProtobufRuntimeVersion(
69 + _runtime_version.Domain.PUBLIC,
76 # @@protoc_insertion_point(imports)
78 _sym_db = _symbol_database.Default()
81 _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
82 _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'types_pb2', _globals)
83 -if _descriptor._USE_C_DESCRIPTORS == False:
84 - DESCRIPTOR._options = None
85 - _globals['_EVENTINFO_EXTRAENTRY']._options = None
86 +if not _descriptor._USE_C_DESCRIPTORS:
87 + DESCRIPTOR._loaded_options = None
88 + _globals['_EVENTINFO_EXTRAENTRY']._loaded_options = None
89 _globals['_EVENTINFO_EXTRAENTRY']._serialized_options = b'8\001'
90 _globals['_EVENTINFO']._serialized_start=62
91 _globals['_EVENTINFO']._serialized_end=335
92 diff --git a/pyproject.toml b/pyproject.toml
93 index 2e40385c..c2878d15 100644
96 @@ -36,7 +36,7 @@ dependencies = [
98 "mashumaro[msgpack]>=3.9,<4.0",
99 "pathspec>=0.9,<0.13",
100 - "protobuf>=4.0.0,<5.0.0",
101 + "protobuf>=5.0,<6.0",
102 "python-dateutil>=2.0,<3.0",
103 "requests<3.0.0", # needs to match dbt-core
104 "typing-extensions>=4.4,<5.0",
105 @@ -52,7 +52,7 @@ lint = [
106 "pytest>=7.3,<8.0", # needed for linting tests
107 "types-Jinja2>=2.11,<3.0",
108 "types-jsonschema>=4.17,<5.0",
109 - "types-protobuf>=4.24,<5.0",
110 + "types-protobuf>=5.0,<6.0",
111 "types-python-dateutil>=2.8,<3.0",
112 "types-PyYAML>=6.0,<7.0",