dbt-common 1.9.0__py3-none-any.whl → 1.11.0__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 CHANGED
@@ -1 +1 @@
1
- version = "1.9.0"
1
+ version = "1.11.0"
@@ -46,6 +46,8 @@ class BehaviorFlagRendered:
46
46
  user_overrides: a set of user settings, one of which may be an override on this behavior flag
47
47
  """
48
48
 
49
+ fired: bool = False
50
+
49
51
  def __init__(self, flag: BehaviorFlag, user_overrides: Dict[str, Any]) -> None:
50
52
  self._validate(flag)
51
53
 
@@ -72,8 +74,9 @@ class BehaviorFlagRendered:
72
74
 
73
75
  @property
74
76
  def setting(self) -> bool:
75
- if self._setting is False:
77
+ if self._setting is False and not self.fired:
76
78
  fire_event(self._behavior_change_event)
79
+ self.fired = True
77
80
  return self._setting
78
81
 
79
82
  @setting.setter
@@ -470,11 +470,16 @@ def create_undefined(node: Optional[_NodeProtocol] = None) -> Type[jinja2.Undefi
470
470
  return Undefined
471
471
 
472
472
 
473
+ def is_list(value):
474
+ return isinstance(value, list)
475
+
476
+
473
477
  NATIVE_FILTERS: Dict[str, Callable[[Any], Any]] = {
474
478
  "as_text": TextMarker,
475
479
  "as_bool": BoolMarker,
476
480
  "as_native": NativeMarker,
477
481
  "as_number": NumberMarker,
482
+ "is_list": is_list,
478
483
  }
479
484
 
480
485
 
@@ -483,6 +488,7 @@ TEXT_FILTERS: Dict[str, Callable[[Any], Any]] = {
483
488
  "as_bool": lambda x: x,
484
489
  "as_native": lambda x: x,
485
490
  "as_number": lambda x: x,
491
+ "is_list": is_list,
486
492
  }
487
493
 
488
494
 
@@ -2,7 +2,6 @@ from enum import Enum
2
2
  import os
3
3
  import threading
4
4
  from dbt_common.events import types_pb2
5
- import sys
6
5
  from google.protobuf.json_format import ParseDict, MessageToDict, MessageToJson
7
6
  from google.protobuf.message import Message
8
7
  from dbt_common.events.helpers import get_json_string_utcnow
@@ -65,14 +64,14 @@ class BaseEvent:
65
64
  kwargs["msg"] = str(kwargs["msg"])
66
65
  try:
67
66
  self.pb_msg = ParseDict(kwargs, msg_cls())
68
- except Exception:
67
+ except Exception as exc:
69
68
  # Imports need to be here to avoid circular imports
70
69
  from dbt_common.events.types import Note
71
70
  from dbt_common.events.functions import fire_event
72
71
 
73
- error_msg = f"[{class_name}]: Unable to parse dict {kwargs}"
72
+ error_msg = f"[{class_name}]: Unable to parse logging event dictionary. {exc}. Dictionary: {kwargs}"
74
73
  # If we're testing throw an error so that we notice failures
75
- if "pytest" in sys.modules:
74
+ if os.getenv("PYTEST_CURRENT_TEST"):
76
75
  raise Exception(error_msg)
77
76
  else:
78
77
  fire_event(Note(msg=error_msg), level=EventLevel.WARN)
@@ -10,13 +10,13 @@ def env_secrets() -> List[str]:
10
10
  return [v for k, v in os.environ.items() if k.startswith(SECRET_ENV_PREFIX) and v.strip()]
11
11
 
12
12
 
13
- def scrub_secrets(msg: str, secrets: List[str]) -> str:
13
+ def scrub_secrets(msg: Any, secrets: List[str]) -> Any:
14
14
  scrubbed = str(msg)
15
15
 
16
16
  for secret in secrets:
17
17
  scrubbed = scrubbed.replace(secret, "*****")
18
18
 
19
- return scrubbed
19
+ return msg if str(msg) == scrubbed else scrubbed
20
20
 
21
21
 
22
22
  class DbtBaseException(Exception):
@@ -240,7 +240,7 @@ class DbtDatabaseError(DbtRuntimeError):
240
240
  lines = []
241
241
 
242
242
  if hasattr(self.node, "build_path") and self.node.build_path:
243
- lines.append(f"compiled Code at {self.node.build_path}")
243
+ lines.append(f"compiled code at {self.node.build_path}")
244
244
 
245
245
  return lines + DbtRuntimeError.process_stack(self)
246
246
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dbt-common
3
- Version: 1.9.0
3
+ Version: 1.11.0
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
@@ -1,6 +1,6 @@
1
- dbt_common/__about__.py,sha256=cXjavBUobbggOyp9SOIeDA3iCRdu2Hzw1qBttGe-RYs,18
1
+ dbt_common/__about__.py,sha256=mD8RxZIPreXVMDcN4OLaJBmakjmOUITJu4JM34eJwD8,19
2
2
  dbt_common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- dbt_common/behavior_flags.py,sha256=GkrXvJ-Q7P73O0XcsIxyYeyiUAOe5E5DdNKIh6x3unE,4809
3
+ dbt_common/behavior_flags.py,sha256=tflh5PubIgEuogslprvnOEA2tM7e7opK6i8GOTnwrgw,4883
4
4
  dbt_common/constants.py,sha256=-Y5DIL1SDPQWtlCNizXRYxFgbx1D7LaLs1ysamvGMRk,278
5
5
  dbt_common/context.py,sha256=rk4EYBU4SpDXRhqbSvDTJwojilxPSoaiEdOxkXow_BU,2549
6
6
  dbt_common/dataclass_schema.py,sha256=u2S0dxwxIghv8RMqC91HlWZJVxmsC_844yZQaGyOwdY,5563
@@ -14,7 +14,7 @@ dbt_common/ui.py,sha256=rc2TEM29raBFc_LXcg901pMDD07C2ohwp9qzkE-7pBY,2567
14
14
  dbt_common/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  dbt_common/clients/_jinja_blocks.py,sha256=xoJK9Y0F93U2PKfT_3SJbBopCGYCtl7LiwKuylXnrEE,12947
16
16
  dbt_common/clients/agate_helper.py,sha256=anKKgKV5PSnFRuFeBwRMdHK3JCaQoUqB2ZXHD0su0Wo,9123
17
- dbt_common/clients/jinja.py,sha256=-eDrUnhH3nxOD0xu81jlweJ_iJqIWdJpYSHZBB27xXo,19682
17
+ dbt_common/clients/jinja.py,sha256=GzpW1BN3W-__YFQ2amyx85Z_qwOOZXEwjmoTIr70HlA,19787
18
18
  dbt_common/clients/system.py,sha256=aoUBtOuXVmkOyj6IhhJ3Y4a7JFzPO2F_zKyOtz3xy44,23932
19
19
  dbt_common/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  dbt_common/contracts/constraints.py,sha256=_f1q3Rkcg2UwA7zI5XBbUMXnPUg6pw17UC7l1HyhyQM,1352
@@ -27,7 +27,7 @@ dbt_common/contracts/config/metadata.py,sha256=X47-tEA8q2ZfSMcYv0godUwTSVjt8NI77
27
27
  dbt_common/contracts/config/properties.py,sha256=gWt6xsP4rVOqRKhmagiUhWnDynzD9mykfMYMTviwpEU,2281
28
28
  dbt_common/events/README.md,sha256=CSwVajoxCAqOug2UCnXldH1EUK7Kjf3rcq7z9ACjrss,3023
29
29
  dbt_common/events/__init__.py,sha256=av08vfpxo0ek7PqZNtMxY8FODJ3xwph4ehRxgInx4LA,383
30
- dbt_common/events/base_types.py,sha256=1l4Yx8zuma7jABB1fcPvL20ltpQ46w0mlYxn48kHykY,5415
30
+ dbt_common/events/base_types.py,sha256=MHlj-DzOmhG9Ds2kNqXtSWxmy_RlwAOFVKu6-WVs3Ik,5460
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=IIUwSyt_RcBbUI_iE5mnpmZt2uW7lG49RXOWz2VlUv0,2300
@@ -41,7 +41,7 @@ dbt_common/events/types.proto,sha256=Ujl0O-X-pat8vlo2C0TMH1LZqa8EP_9f8k2TjbFuCV8
41
41
  dbt_common/events/types.py,sha256=MXCmG7qaj7hLbDZjjazjWftPTfoLjhNPATPMirO0DvU,4475
42
42
  dbt_common/events/types_pb2.py,sha256=oFjR6pFqz3_Nk8wWIrVB9y6inNTxnj-CSGr2g8dnFz4,7167
43
43
  dbt_common/exceptions/__init__.py,sha256=X_Uw7BxOzXev_9JMYfs5Cm-_i_Qf2PJim8_-dDJI7Y8,361
44
- dbt_common/exceptions/base.py,sha256=d6lsA8sLqR6_BERowm91Mrs1ZwrEOeT8WQKWg4nPSPA,7750
44
+ dbt_common/exceptions/base.py,sha256=23ijq-AtQgUSvZ9JbrCIZ87Pbyn8iEYezX95IXAZ4FY,7783
45
45
  dbt_common/exceptions/cache.py,sha256=0z4fBcdNZMAR41YbPRo2GN0__xAMaYs8Uc-t3hjmVio,2532
46
46
  dbt_common/exceptions/connection.py,sha256=rXLJXUdLhyXP3CUUyiqWN2DDO5-0Pn1ChX3OIR7pxKk,176
47
47
  dbt_common/exceptions/contracts.py,sha256=i2PKRqda1Pq_Sro9FA22W7FTGklhBAGl6__nimR5_qI,527
@@ -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.9.0.dist-info/METADATA,sha256=gJ4sX5mtKWkJP66WbImh-5UrFsb5Mo3KQkoGkzbbsAQ,5298
61
- dbt_common-1.9.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
62
- dbt_common-1.9.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
63
- dbt_common-1.9.0.dist-info/RECORD,,
60
+ dbt_common-1.11.0.dist-info/METADATA,sha256=MQj_0ruvmXW57fvRN94WNtYjX71MDdxcaYic-a9QrOg,5299
61
+ dbt_common-1.11.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
62
+ dbt_common-1.11.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
63
+ dbt_common-1.11.0.dist-info/RECORD,,