dbt-common 1.17.0__py3-none-any.whl → 1.18__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dbt_common/__about__.py +1 -1
- dbt_common/events/event_manager_client.py +0 -3
- dbt_common/events/helpers.py +2 -2
- dbt_common/events/logger.py +2 -2
- dbt_common/events/types.proto +10 -0
- dbt_common/events/types.py +11 -1
- dbt_common/events/types_pb2.py +5 -1
- dbt_common/helper_types.py +141 -5
- dbt_common/record.py +7 -0
- {dbt_common-1.17.0.dist-info → dbt_common-1.18.dist-info}/METADATA +2 -1
- {dbt_common-1.17.0.dist-info → dbt_common-1.18.dist-info}/RECORD +13 -13
- {dbt_common-1.17.0.dist-info → dbt_common-1.18.dist-info}/WHEEL +0 -0
- {dbt_common-1.17.0.dist-info → dbt_common-1.18.dist-info}/licenses/LICENSE +0 -0
dbt_common/__about__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
version = "1.
|
1
|
+
version = "1.18"
|
@@ -8,17 +8,14 @@ _EVENT_MANAGER: IEventManager = EventManager()
|
|
8
8
|
|
9
9
|
|
10
10
|
def get_event_manager() -> IEventManager:
|
11
|
-
global _EVENT_MANAGER
|
12
11
|
return _EVENT_MANAGER
|
13
12
|
|
14
13
|
|
15
14
|
def add_logger_to_manager(logger) -> None:
|
16
|
-
global _EVENT_MANAGER
|
17
15
|
_EVENT_MANAGER.add_logger(logger)
|
18
16
|
|
19
17
|
|
20
18
|
def add_callback_to_manager(callback: TCallback) -> None:
|
21
|
-
global _EVENT_MANAGER
|
22
19
|
_EVENT_MANAGER.add_callback(callback)
|
23
20
|
|
24
21
|
|
dbt_common/events/helpers.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from datetime import datetime
|
1
|
+
from datetime import datetime, timezone
|
2
2
|
|
3
3
|
|
4
4
|
# This converts a datetime to a json format datetime string which
|
@@ -9,6 +9,6 @@ def datetime_to_json_string(dt: datetime) -> str:
|
|
9
9
|
|
10
10
|
# preformatted time stamp
|
11
11
|
def get_json_string_utcnow() -> str:
|
12
|
-
ts = datetime.
|
12
|
+
ts = datetime.now(timezone.utc).replace(tzinfo=None)
|
13
13
|
ts_rfc3339 = datetime_to_json_string(ts)
|
14
14
|
return ts_rfc3339
|
dbt_common/events/logger.py
CHANGED
@@ -2,7 +2,7 @@ import json
|
|
2
2
|
import logging
|
3
3
|
import threading
|
4
4
|
from dataclasses import dataclass
|
5
|
-
from datetime import datetime
|
5
|
+
from datetime import datetime, timezone
|
6
6
|
from enum import Enum
|
7
7
|
from logging.handlers import RotatingFileHandler
|
8
8
|
from typing import Optional, TextIO, Any, Callable
|
@@ -156,7 +156,7 @@ class _TextLogger(_Logger):
|
|
156
156
|
if _is_print_event(msg):
|
157
157
|
# PrintEvent is a special case, we don't want to add a timestamp
|
158
158
|
return scrubbed_msg
|
159
|
-
ts: str = datetime.
|
159
|
+
ts: str = datetime.now(timezone.utc).replace(tzinfo=None).strftime("%H:%M:%S")
|
160
160
|
return f"{self._get_color_tag()}{ts} {scrubbed_msg}"
|
161
161
|
|
162
162
|
def create_debug_line(self, msg: EventMsg) -> str:
|
dbt_common/events/types.proto
CHANGED
@@ -144,3 +144,13 @@ message PrintEventMsg {
|
|
144
144
|
EventInfo info = 1;
|
145
145
|
PrintEvent data = 2;
|
146
146
|
}
|
147
|
+
|
148
|
+
// Z053
|
149
|
+
message RecordReplayIssue {
|
150
|
+
string msg = 1;
|
151
|
+
}
|
152
|
+
|
153
|
+
message RecordReplayIssueMsg {
|
154
|
+
EventInfo info = 1;
|
155
|
+
RecordReplayIssue data = 2;
|
156
|
+
}
|
dbt_common/events/types.py
CHANGED
@@ -118,7 +118,7 @@ class SystemReportReturnCode(DebugLevel):
|
|
118
118
|
|
119
119
|
|
120
120
|
# We use events to create console output, but also think of them as a sequence of important and
|
121
|
-
# meaningful occurrences to be used for debugging and monitoring. The Formatting event
|
121
|
+
# meaningful occurrences to be used for debugging and monitoring. The Formatting event eases
|
122
122
|
# the tension between these two goals by allowing empty lines, heading separators, and other
|
123
123
|
# formatting to be written to the console, while they can be ignored for other purposes. For
|
124
124
|
# general information that isn't simple formatting, the Note event should be used instead.
|
@@ -156,3 +156,13 @@ class PrintEvent(InfoLevel):
|
|
156
156
|
|
157
157
|
def message(self) -> str:
|
158
158
|
return self.msg
|
159
|
+
|
160
|
+
|
161
|
+
class RecordReplayIssue(InfoLevel):
|
162
|
+
"""General event for reporting record/replay issues at runtime."""
|
163
|
+
|
164
|
+
def code(self) -> str:
|
165
|
+
return "Z053"
|
166
|
+
|
167
|
+
def message(self) -> str:
|
168
|
+
return self.msg
|
dbt_common/events/types_pb2.py
CHANGED
@@ -25,7 +25,7 @@ _sym_db = _symbol_database.Default()
|
|
25
25
|
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
|
26
26
|
|
27
27
|
|
28
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0btypes.proto\x12\x0bproto_types\x1a\x1fgoogle/protobuf/timestamp.proto\"\x91\x02\n\tEventInfo\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04\x63ode\x18\x02 \x01(\t\x12\x0b\n\x03msg\x18\x03 \x01(\t\x12\r\n\x05level\x18\x04 \x01(\t\x12\x15\n\rinvocation_id\x18\x05 \x01(\t\x12\x0b\n\x03pid\x18\x06 \x01(\x05\x12\x0e\n\x06thread\x18\x07 \x01(\t\x12&\n\x02ts\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x30\n\x05\x65xtra\x18\t \x03(\x0b\x32!.proto_types.EventInfo.ExtraEntry\x12\x10\n\x08\x63\x61tegory\x18\n \x01(\t\x1a,\n\nExtraEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"6\n\x0eGenericMessage\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\"d\n\x13\x42\x65haviorChangeEvent\x12\x11\n\tflag_name\x18\x01 \x01(\t\x12\x13\n\x0b\x66lag_source\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x10\n\x08\x64ocs_url\x18\x04 \x01(\t\"n\n\x16\x42\x65haviorChangeEventMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12.\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32 .proto_types.BehaviorChangeEvent\"1\n\x11RetryExternalCall\x12\x0f\n\x07\x61ttempt\x18\x01 \x01(\x05\x12\x0b\n\x03max\x18\x02 \x01(\x05\"j\n\x14RetryExternalCallMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12,\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x1e.proto_types.RetryExternalCall\"#\n\x14RecordRetryException\x12\x0b\n\x03\x65xc\x18\x01 \x01(\t\"p\n\x17RecordRetryExceptionMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12/\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32!.proto_types.RecordRetryException\"@\n\x13SystemCouldNotWrite\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x0e\n\x06reason\x18\x02 \x01(\t\x12\x0b\n\x03\x65xc\x18\x03 \x01(\t\"n\n\x16SystemCouldNotWriteMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12.\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32 .proto_types.SystemCouldNotWrite\"!\n\x12SystemExecutingCmd\x12\x0b\n\x03\x63md\x18\x01 \x03(\t\"l\n\x15SystemExecutingCmdMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12-\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x1f.proto_types.SystemExecutingCmd\"\x1c\n\x0cSystemStdOut\x12\x0c\n\x04\x62msg\x18\x01 \x01(\t\"`\n\x0fSystemStdOutMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12\'\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x19.proto_types.SystemStdOut\"\x1c\n\x0cSystemStdErr\x12\x0c\n\x04\x62msg\x18\x01 \x01(\t\"`\n\x0fSystemStdErrMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12\'\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x19.proto_types.SystemStdErr\",\n\x16SystemReportReturnCode\x12\x12\n\nreturncode\x18\x01 \x01(\x05\"t\n\x19SystemReportReturnCodeMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12\x31\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32#.proto_types.SystemReportReturnCode\"\x19\n\nFormatting\x12\x0b\n\x03msg\x18\x01 \x01(\t\"\\\n\rFormattingMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12%\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x17.proto_types.Formatting\"\x13\n\x04Note\x12\x0b\n\x03msg\x18\x01 \x01(\t\"P\n\x07NoteMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12\x1f\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x11.proto_types.Note\"\x19\n\nPrintEvent\x12\x0b\n\x03msg\x18\x01 \x01(\t\"\\\n\rPrintEventMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12%\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x17.proto_types.
|
28
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0btypes.proto\x12\x0bproto_types\x1a\x1fgoogle/protobuf/timestamp.proto\"\x91\x02\n\tEventInfo\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04\x63ode\x18\x02 \x01(\t\x12\x0b\n\x03msg\x18\x03 \x01(\t\x12\r\n\x05level\x18\x04 \x01(\t\x12\x15\n\rinvocation_id\x18\x05 \x01(\t\x12\x0b\n\x03pid\x18\x06 \x01(\x05\x12\x0e\n\x06thread\x18\x07 \x01(\t\x12&\n\x02ts\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x30\n\x05\x65xtra\x18\t \x03(\x0b\x32!.proto_types.EventInfo.ExtraEntry\x12\x10\n\x08\x63\x61tegory\x18\n \x01(\t\x1a,\n\nExtraEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"6\n\x0eGenericMessage\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\"d\n\x13\x42\x65haviorChangeEvent\x12\x11\n\tflag_name\x18\x01 \x01(\t\x12\x13\n\x0b\x66lag_source\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x10\n\x08\x64ocs_url\x18\x04 \x01(\t\"n\n\x16\x42\x65haviorChangeEventMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12.\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32 .proto_types.BehaviorChangeEvent\"1\n\x11RetryExternalCall\x12\x0f\n\x07\x61ttempt\x18\x01 \x01(\x05\x12\x0b\n\x03max\x18\x02 \x01(\x05\"j\n\x14RetryExternalCallMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12,\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x1e.proto_types.RetryExternalCall\"#\n\x14RecordRetryException\x12\x0b\n\x03\x65xc\x18\x01 \x01(\t\"p\n\x17RecordRetryExceptionMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12/\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32!.proto_types.RecordRetryException\"@\n\x13SystemCouldNotWrite\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x0e\n\x06reason\x18\x02 \x01(\t\x12\x0b\n\x03\x65xc\x18\x03 \x01(\t\"n\n\x16SystemCouldNotWriteMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12.\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32 .proto_types.SystemCouldNotWrite\"!\n\x12SystemExecutingCmd\x12\x0b\n\x03\x63md\x18\x01 \x03(\t\"l\n\x15SystemExecutingCmdMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12-\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x1f.proto_types.SystemExecutingCmd\"\x1c\n\x0cSystemStdOut\x12\x0c\n\x04\x62msg\x18\x01 \x01(\t\"`\n\x0fSystemStdOutMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12\'\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x19.proto_types.SystemStdOut\"\x1c\n\x0cSystemStdErr\x12\x0c\n\x04\x62msg\x18\x01 \x01(\t\"`\n\x0fSystemStdErrMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12\'\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x19.proto_types.SystemStdErr\",\n\x16SystemReportReturnCode\x12\x12\n\nreturncode\x18\x01 \x01(\x05\"t\n\x19SystemReportReturnCodeMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12\x31\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32#.proto_types.SystemReportReturnCode\"\x19\n\nFormatting\x12\x0b\n\x03msg\x18\x01 \x01(\t\"\\\n\rFormattingMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12%\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x17.proto_types.Formatting\"\x13\n\x04Note\x12\x0b\n\x03msg\x18\x01 \x01(\t\"P\n\x07NoteMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12\x1f\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x11.proto_types.Note\"\x19\n\nPrintEvent\x12\x0b\n\x03msg\x18\x01 \x01(\t\"\\\n\rPrintEventMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12%\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x17.proto_types.PrintEvent\" \n\x11RecordReplayIssue\x12\x0b\n\x03msg\x18\x01 \x01(\t\"j\n\x14RecordReplayIssueMsg\x12$\n\x04info\x18\x01 \x01(\x0b\x32\x16.proto_types.EventInfo\x12,\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x1e.proto_types.RecordReplayIssueb\x06proto3')
|
29
29
|
|
30
30
|
_globals = globals()
|
31
31
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
@@ -84,4 +84,8 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
84
84
|
_globals['_PRINTEVENT']._serialized_end=1909
|
85
85
|
_globals['_PRINTEVENTMSG']._serialized_start=1911
|
86
86
|
_globals['_PRINTEVENTMSG']._serialized_end=2003
|
87
|
+
_globals['_RECORDREPLAYISSUE']._serialized_start=2005
|
88
|
+
_globals['_RECORDREPLAYISSUE']._serialized_end=2037
|
89
|
+
_globals['_RECORDREPLAYISSUEMSG']._serialized_start=2039
|
90
|
+
_globals['_RECORDREPLAYISSUEMSG']._serialized_end=2145
|
87
91
|
# @@protoc_insertion_point(module_scope)
|
dbt_common/helper_types.py
CHANGED
@@ -12,6 +12,7 @@ from dbt_common.dataclass_schema import (
|
|
12
12
|
ValidationError,
|
13
13
|
StrEnum,
|
14
14
|
)
|
15
|
+
from dbt_common.events.base_types import BaseEvent
|
15
16
|
|
16
17
|
Port = NewType("Port", int)
|
17
18
|
|
@@ -64,6 +65,22 @@ class IncludeExclude(dbtClassMixin):
|
|
64
65
|
|
65
66
|
|
66
67
|
class WarnErrorOptions(IncludeExclude):
|
68
|
+
"""
|
69
|
+
This class is used to configure the behavior of the warn_error feature (now part of fire_event).
|
70
|
+
|
71
|
+
include: "all", "*", or a list of event names.
|
72
|
+
exclude: a list of event names.
|
73
|
+
silence: a list of event names.
|
74
|
+
valid_error_names: a set of event names that can be named in include, exclude, and silence.
|
75
|
+
|
76
|
+
In a hierarchy of configuration, the following rules apply:
|
77
|
+
1. named > Deprecations > "all"/"*"
|
78
|
+
2. silence > exclude > include
|
79
|
+
3. (1) > (2)
|
80
|
+
"""
|
81
|
+
|
82
|
+
DEPRECATIONS = "Deprecations"
|
83
|
+
|
67
84
|
def __init__(
|
68
85
|
self,
|
69
86
|
include: Union[str, List[str]],
|
@@ -73,18 +90,137 @@ class WarnErrorOptions(IncludeExclude):
|
|
73
90
|
):
|
74
91
|
self.silence = silence or []
|
75
92
|
self._valid_error_names: Set[str] = valid_error_names or set()
|
93
|
+
self._valid_error_names.add(self.DEPRECATIONS)
|
76
94
|
super().__init__(include=include, exclude=(exclude or []))
|
77
95
|
|
78
96
|
def __post_init__(self):
|
79
|
-
|
80
|
-
|
97
|
+
if isinstance(self.include, str) and self.include not in self.INCLUDE_ALL:
|
98
|
+
raise ValidationError(
|
99
|
+
f"include must be one of {self.INCLUDE_ALL} or a list of strings"
|
100
|
+
)
|
81
101
|
|
82
|
-
|
83
|
-
|
102
|
+
# To specify exclude, either `include` must be "all" or "deprecations" must be
|
103
|
+
# in `include` or `silence`.
|
104
|
+
if self.exclude and not (
|
105
|
+
self.include in self.INCLUDE_ALL
|
106
|
+
or self.DEPRECATIONS in self.include
|
107
|
+
or self.DEPRECATIONS in self.silence
|
108
|
+
):
|
109
|
+
raise ValidationError(
|
110
|
+
f"exclude can only be specified if include is one of {self.INCLUDE_ALL} or "
|
111
|
+
f"{self.DEPRECATIONS} is in include or silence."
|
112
|
+
)
|
113
|
+
|
114
|
+
if isinstance(self.include, list):
|
115
|
+
self._validate_items(self.include)
|
84
116
|
|
85
|
-
|
117
|
+
if isinstance(self.exclude, list):
|
118
|
+
self._validate_items(self.exclude)
|
119
|
+
|
120
|
+
if isinstance(self.silence, list):
|
121
|
+
self._validate_items(self.silence)
|
122
|
+
|
123
|
+
def _includes_all(self) -> bool:
|
124
|
+
"""Is `*` or `all` set as include?"""
|
125
|
+
return self.include in self.INCLUDE_ALL
|
126
|
+
|
127
|
+
def _named_inclusion(self, item_name: str) -> bool:
|
128
|
+
"""Is the item_name named in the include list?"""
|
129
|
+
return item_name in self.include
|
130
|
+
|
131
|
+
def _named_exclusion(self, item_name: str) -> bool:
|
132
|
+
"""Is the item_name named in the exclude list?"""
|
133
|
+
return item_name in self.exclude
|
134
|
+
|
135
|
+
def _named_silence(self, item_name: str) -> bool:
|
136
|
+
"""Is the item_name named in the silence list?"""
|
86
137
|
return item_name in self.silence
|
87
138
|
|
139
|
+
def _include_as_deprecation(self, event: Optional[BaseEvent]) -> bool:
|
140
|
+
"""Is event included as a deprecation?"""
|
141
|
+
return (
|
142
|
+
event is not None
|
143
|
+
and event.code().startswith("D")
|
144
|
+
and self.DEPRECATIONS in self.include
|
145
|
+
)
|
146
|
+
|
147
|
+
def _exclude_as_deprecation(self, event: Optional[BaseEvent]) -> bool:
|
148
|
+
"""Is event excluded as a deprecation?"""
|
149
|
+
return (
|
150
|
+
event is not None
|
151
|
+
and event.code().startswith("D")
|
152
|
+
and self.DEPRECATIONS in self.exclude
|
153
|
+
)
|
154
|
+
|
155
|
+
def _silence_as_deprecation(self, event: Optional[BaseEvent]) -> bool:
|
156
|
+
"""Is event silenced as a deprecation?"""
|
157
|
+
return (
|
158
|
+
event is not None
|
159
|
+
and event.code().startswith("D")
|
160
|
+
and self.DEPRECATIONS in self.silence
|
161
|
+
)
|
162
|
+
|
163
|
+
def includes(self, item_name: Union[str, BaseEvent]) -> bool:
|
164
|
+
"""Is the event included?
|
165
|
+
|
166
|
+
An event included if any of the following are true:
|
167
|
+
- The event is named in `include` and not named in `exclude` or `silence`
|
168
|
+
- "*" or "all" is specified for `include`, and the event is not named in `exclude` or `silence`
|
169
|
+
- The event is a deprecation, "deprecations" is in `include`, and the event is not named in `exclude` or `silence`
|
170
|
+
nor is "deprecations" in `exclude` or `silence`
|
171
|
+
"""
|
172
|
+
# Setup based on item_name type
|
173
|
+
if isinstance(item_name, str):
|
174
|
+
event_name = item_name
|
175
|
+
event = None
|
176
|
+
else:
|
177
|
+
event_name = type(item_name).__name__
|
178
|
+
event = item_name
|
179
|
+
|
180
|
+
# Pre-compute checks that will be used multiple times
|
181
|
+
named_elsewhere = self._named_exclusion(event_name) or self._named_silence(event_name)
|
182
|
+
deprecation_elsewhere = self._exclude_as_deprecation(
|
183
|
+
event
|
184
|
+
) or self._silence_as_deprecation(event)
|
185
|
+
|
186
|
+
# Calculate result
|
187
|
+
if self._named_inclusion(event_name) and not named_elsewhere:
|
188
|
+
return True
|
189
|
+
elif self._include_as_deprecation(event) and not (
|
190
|
+
named_elsewhere or deprecation_elsewhere
|
191
|
+
):
|
192
|
+
return True
|
193
|
+
elif self._includes_all() and not (named_elsewhere or deprecation_elsewhere):
|
194
|
+
return True
|
195
|
+
else:
|
196
|
+
return False
|
197
|
+
|
198
|
+
def silenced(self, item_name: Union[str, BaseEvent]) -> bool:
|
199
|
+
"""Is the event silenced?
|
200
|
+
|
201
|
+
An event silenced if any of the following are true:
|
202
|
+
- The event is named in `silence`
|
203
|
+
- "Deprecations" is in `silence` and the event is not named in `include` or `exclude`
|
204
|
+
"""
|
205
|
+
# Setup based on item_name type
|
206
|
+
if isinstance(item_name, str):
|
207
|
+
event_name = item_name
|
208
|
+
event = None
|
209
|
+
else:
|
210
|
+
event_name = type(item_name).__name__
|
211
|
+
event = item_name
|
212
|
+
|
213
|
+
# Pre-compute checks that will be used multiple times
|
214
|
+
named_elsewhere = self._named_inclusion(event_name) or self._named_exclusion(event_name)
|
215
|
+
|
216
|
+
# Calculate result
|
217
|
+
if self._named_silence(event_name):
|
218
|
+
return True
|
219
|
+
elif self._silence_as_deprecation(event) and not named_elsewhere:
|
220
|
+
return True
|
221
|
+
else:
|
222
|
+
return False
|
223
|
+
|
88
224
|
def _validate_items(self, items: List[str]):
|
89
225
|
for item in items:
|
90
226
|
if item not in self._valid_error_names:
|
dbt_common/record.py
CHANGED
@@ -457,6 +457,13 @@ def _record_function_inner(
|
|
457
457
|
index_on_thread_id,
|
458
458
|
func_to_record,
|
459
459
|
):
|
460
|
+
recorded_types = get_record_types_from_env()
|
461
|
+
if recorded_types is not None and not (
|
462
|
+
getattr(record_type, "__name__", record_type) in recorded_types
|
463
|
+
or getattr(record_type, "group", group) in recorded_types
|
464
|
+
):
|
465
|
+
return func_to_record
|
466
|
+
|
460
467
|
if isinstance(record_type, str):
|
461
468
|
return_type = inspect.signature(func_to_record).return_annotation
|
462
469
|
fields = _get_arg_fields(inspect.getfullargspec(func_to_record), method)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: dbt-common
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.18
|
4
4
|
Summary: The shared common utilities that dbt-core and adapter implementations use
|
5
5
|
Project-URL: Homepage, https://github.com/dbt-labs/dbt-common
|
6
6
|
Project-URL: Repository, https://github.com/dbt-labs/dbt-common.git
|
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.10
|
21
21
|
Classifier: Programming Language :: Python :: 3.11
|
22
22
|
Classifier: Programming Language :: Python :: 3.12
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
23
24
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
24
25
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
25
26
|
Requires-Python: >=3.9
|
@@ -1,13 +1,13 @@
|
|
1
|
-
dbt_common/__about__.py,sha256=
|
1
|
+
dbt_common/__about__.py,sha256=ERrGU780ALGuoRiYc9GL9A5N222lJo4nym34aldvEjY,17
|
2
2
|
dbt_common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
dbt_common/behavior_flags.py,sha256=hQzxCqQSweJbRp_xoQqNnlUF77PBuOdCdLOSdcBlkxk,4885
|
4
4
|
dbt_common/constants.py,sha256=-Y5DIL1SDPQWtlCNizXRYxFgbx1D7LaLs1ysamvGMRk,278
|
5
5
|
dbt_common/context.py,sha256=-ErtKG4xfOh1-Y569fwu6u2O381nRan18HhATrYDoZE,2950
|
6
6
|
dbt_common/dataclass_schema.py,sha256=u2S0dxwxIghv8RMqC91HlWZJVxmsC_844yZQaGyOwdY,5563
|
7
|
-
dbt_common/helper_types.py,sha256=
|
7
|
+
dbt_common/helper_types.py,sha256=v6ak-05SodNDxJM7BGXyCT4yPM-OUhcvznjemXRYT-g,9117
|
8
8
|
dbt_common/invocation.py,sha256=xw0NBIE-6LHd135cx4non-MkGGsia0mYN0lMkmNEucE,435
|
9
9
|
dbt_common/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
dbt_common/record.py,sha256=
|
10
|
+
dbt_common/record.py,sha256=QLrKppBHYuV7ZTckOMi4Gnz7jLQJcOa5kp4PwK0JmwY,21889
|
11
11
|
dbt_common/semver.py,sha256=Znewz6tc_NBpXr4mZf20bK_RayPL4ODrnxDbkUZrrRo,15034
|
12
12
|
dbt_common/tests.py,sha256=6lC_JuRtoYO6cbAF8-R5aTM4HtQiM_EH8X5m_97duGY,315
|
13
13
|
dbt_common/ui.py,sha256=rc2TEM29raBFc_LXcg901pMDD07C2ohwp9qzkE-7pBY,2567
|
@@ -31,15 +31,15 @@ dbt_common/events/base_types.py,sha256=bdDMbawAV0FkxmvuxgsTev82vxTuyu6rJiSkvEQPs
|
|
31
31
|
dbt_common/events/contextvars.py,sha256=EIs1P6NrJzx_IAV17x5cVqOAS4Lqbu6oc0etHtWCJOo,3097
|
32
32
|
dbt_common/events/event_handler.py,sha256=jfi0PyqIOGnXCG9HEa0VIVULqNvXs1RYmAg0b50ChQs,1385
|
33
33
|
dbt_common/events/event_manager.py,sha256=0CDHNh_qTjdj4blpJiJ7gq6YkP1NzjE0iIct4v_MdoA,4588
|
34
|
-
dbt_common/events/event_manager_client.py,sha256=
|
34
|
+
dbt_common/events/event_manager_client.py,sha256=5IVdIuRVi5xCNQGiZqXdywlED2kLj1W_Pj0lh2HiDiI,1115
|
35
35
|
dbt_common/events/format.py,sha256=x1RWDZ8G7ZMHmxdld6Q4VXca4kvnhiQOIaQXkC6Uo0Q,1609
|
36
36
|
dbt_common/events/functions.py,sha256=R3DuyNy2TqOwNyMACVOYtiG1NjZ9FQa6FWKkzMeMCBY,4767
|
37
|
-
dbt_common/events/helpers.py,sha256=
|
37
|
+
dbt_common/events/helpers.py,sha256=29FF0ZR24Zdvk23-bzIZKu8Pb4wFn-B1fFx28lLIpNw,450
|
38
38
|
dbt_common/events/interfaces.py,sha256=hEDeDoB0FW2RYHVZBG7gebEt_mUVBzkn1yPubpaxs-s,147
|
39
|
-
dbt_common/events/logger.py,sha256=
|
40
|
-
dbt_common/events/types.proto,sha256=
|
41
|
-
dbt_common/events/types.py,sha256=
|
42
|
-
dbt_common/events/types_pb2.py,sha256=
|
39
|
+
dbt_common/events/logger.py,sha256=siCM47WnjiA5wWoYzHDqe9mIr-b-XYNctP8r3o1zvSc,6800
|
40
|
+
dbt_common/events/types.proto,sha256=ohV5f2KfhaM3NRWHFJBNJQtqP3Hie65smA0imlWNkHg,2425
|
41
|
+
dbt_common/events/types.py,sha256=Xg2QBLTWSM_p2BP_Key_JcygmR1LyNYzQhKVYvZ9Zmc,4683
|
42
|
+
dbt_common/events/types_pb2.py,sha256=fgIoTp7-0hy9FMM0tiJmzENupZH_Vl28Xz2IRvg2KGg,7862
|
43
43
|
dbt_common/exceptions/__init__.py,sha256=X_Uw7BxOzXev_9JMYfs5Cm-_i_Qf2PJim8_-dDJI7Y8,361
|
44
44
|
dbt_common/exceptions/base.py,sha256=23ijq-AtQgUSvZ9JbrCIZ87Pbyn8iEYezX95IXAZ4FY,7783
|
45
45
|
dbt_common/exceptions/cache.py,sha256=0z4fBcdNZMAR41YbPRo2GN0__xAMaYs8Uc-t3hjmVio,2532
|
@@ -57,7 +57,7 @@ dbt_common/utils/encoding.py,sha256=6_kSY2FvGNYMg7oX7PrbvVioieydih3Kl7Ii802LaHI,
|
|
57
57
|
dbt_common/utils/executor.py,sha256=pNY0UbPlwQmTE69Vt_Rj91YGCIOEaqeYU3CjAds0T70,2454
|
58
58
|
dbt_common/utils/formatting.py,sha256=JUn5rzJ-uajs9wPCN0-f2iRFY1pOJF5YjTD9dERuLoc,165
|
59
59
|
dbt_common/utils/jinja.py,sha256=JXgNmJArGGy0h7qkbNLA3zaEQmoF1CxsNBYTlIwFXDw,1101
|
60
|
-
dbt_common-1.
|
61
|
-
dbt_common-1.
|
62
|
-
dbt_common-1.
|
63
|
-
dbt_common-1.
|
60
|
+
dbt_common-1.18.dist-info/METADATA,sha256=gd7IHI2wW8J1_OUnmv8GtW2rybVmr9_FiOKIrAZ8QHM,4944
|
61
|
+
dbt_common-1.18.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
62
|
+
dbt_common-1.18.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
63
|
+
dbt_common-1.18.dist-info/RECORD,,
|
File without changes
|
File without changes
|