dbt-common 1.30.0__py3-none-any.whl → 1.31.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.30.0"
1
+ version = "1.31.0"
dbt_common/invocation.py CHANGED
@@ -1,8 +1,8 @@
1
1
  import uuid
2
- from datetime import datetime
2
+ from datetime import datetime, timezone
3
3
 
4
4
  _INVOCATION_ID = str(uuid.uuid4())
5
- _INVOCATION_STARTED_AT = datetime.utcnow()
5
+ _INVOCATION_STARTED_AT = datetime.now(timezone.utc).replace(tzinfo=None)
6
6
 
7
7
 
8
8
  def get_invocation_id() -> str:
@@ -16,4 +16,4 @@ def get_invocation_started_at() -> datetime:
16
16
  def reset_invocation_id() -> None:
17
17
  global _INVOCATION_ID, _INVOCATION_STARTED_AT
18
18
  _INVOCATION_ID = str(uuid.uuid4())
19
- _INVOCATION_STARTED_AT = datetime.utcnow()
19
+ _INVOCATION_STARTED_AT = datetime.now(timezone.utc).replace(tzinfo=None)
dbt_common/record.py CHANGED
@@ -448,8 +448,9 @@ class AutoValues(DataClassJSONMixin):
448
448
  def _to_dict(self):
449
449
  return self.to_dict()
450
450
 
451
- def _from_dict(self, data):
452
- return self.from_dict(data)
451
+ @classmethod
452
+ def _from_dict(cls, data):
453
+ return cls.from_dict(data)
453
454
 
454
455
 
455
456
  def _record_function_inner(
@@ -534,16 +535,37 @@ def _record_function_inner(
534
535
  else:
535
536
  param_args = (getattr(args[0], id_field_name),) + param_args
536
537
 
537
- params = record_type.params_cls(*param_args, **kwargs)
538
+ # Build params - this can be dangerous if a subclass overrides the method in such a way that
539
+ # changes the signature of the base recorded method, and so is wrapped in a try/except.
540
+ params = None
541
+ try:
542
+ # Omits any additional properties that are not fields of the params class
543
+ params_dict = {
544
+ field.name: value
545
+ for field, value in zip(dataclasses.fields(record_type.params_cls), param_args)
546
+ }
547
+ params_dict.update(kwargs)
548
+ try:
549
+ params = record_type.params_cls._from_dict(params_dict)
550
+ except (TypeError, AttributeError):
551
+ params = record_type.params_cls(*param_args, **kwargs)
552
+ except Exception:
553
+ # Unfortunately it is not possible to fire an event here because it would cause a circular import
554
+ # This means we lose visibility into the issue, but it is better than crashing the entire node or command
555
+ pass
556
+ except Exception:
557
+ # Unfortunately it is not possible to fire an event here because it would cause a circular import
558
+ # This means we lose visibility into the issue, but it is better than crashing the entire node or command
559
+ pass
538
560
 
539
561
  include = True
540
- if hasattr(params, "_include"):
562
+ if params is not None and hasattr(params, "_include"):
541
563
  include = params._include()
542
564
 
543
565
  if not include:
544
566
  return func_to_record(*call_args, **kwargs)
545
567
 
546
- if recorder.mode == RecorderMode.REPLAY:
568
+ if recorder.mode == RecorderMode.REPLAY and params is not None:
547
569
  return recorder.expect_record(params)
548
570
  if RECORDED_BY_HIGHER_FUNCTION.get():
549
571
  return func_to_record(*call_args, **kwargs)
@@ -558,7 +580,8 @@ def _record_function_inner(
558
580
  else record_type.result_cls(r)
559
581
  )
560
582
  RECORDED_BY_HIGHER_FUNCTION.set(False)
561
- recorder.add_record(record_type(params=params, result=result))
583
+ if params is not None:
584
+ recorder.add_record(record_type(params=params, result=result))
562
585
  return r
563
586
 
564
587
  setattr(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dbt-common
3
- Version: 1.30.0
3
+ Version: 1.31.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,13 +1,13 @@
1
- dbt_common/__about__.py,sha256=viCczsd3VwR7vc-Nf1WvTRKrmjS-j4d6w4YjgS79j9Q,19
1
+ dbt_common/__about__.py,sha256=GY1J5mpmws_U4-5YJ7wyu27HoxTMfH6V135Ll8xlp6k,19
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=6ATQPXft7vw_vyhnmkGy3geKfuzWC3ZiUH4kuNuGQ5w,381
5
5
  dbt_common/context.py,sha256=w0XfTvQNxtuctHm8hxsdySFoInggBMQm2-7faa_7ObU,3317
6
6
  dbt_common/dataclass_schema.py,sha256=u2S0dxwxIghv8RMqC91HlWZJVxmsC_844yZQaGyOwdY,5563
7
7
  dbt_common/helper_types.py,sha256=wxbbjfsvHVraWexK88PEY3q_dAYqlPl6yOIXnpxCcyY,11569
8
- dbt_common/invocation.py,sha256=xw0NBIE-6LHd135cx4non-MkGGsia0mYN0lMkmNEucE,435
8
+ dbt_common/invocation.py,sha256=PzWsS7TJSfLzG1_Y3dq1fmfTDuZAjUN7794DglJqTTM,505
9
9
  dbt_common/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- dbt_common/record.py,sha256=uZdE2gqqQYXkW5OSYo7urCbjeeWSOAKFoomtdVlOm4U,22637
10
+ dbt_common/record.py,sha256=ybe4Kyy9FJ_uc1K-0tk6Gv2cbD8kpdVIAy5APbrBWfQ,23965
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=geIk3ElFj5y_SG5EDc6RMJFEvYGdo-6C21l0pB8I-EU,2934
@@ -56,7 +56,7 @@ dbt_common/utils/encoding.py,sha256=6_kSY2FvGNYMg7oX7PrbvVioieydih3Kl7Ii802LaHI,
56
56
  dbt_common/utils/executor.py,sha256=pNY0UbPlwQmTE69Vt_Rj91YGCIOEaqeYU3CjAds0T70,2454
57
57
  dbt_common/utils/formatting.py,sha256=JUn5rzJ-uajs9wPCN0-f2iRFY1pOJF5YjTD9dERuLoc,165
58
58
  dbt_common/utils/jinja.py,sha256=JXgNmJArGGy0h7qkbNLA3zaEQmoF1CxsNBYTlIwFXDw,1101
59
- dbt_common-1.30.0.dist-info/METADATA,sha256=sJh-RDYvL8D6BYSGCUHSmw3XbF4mpd2osuHKApmVqeA,4988
60
- dbt_common-1.30.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
61
- dbt_common-1.30.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
62
- dbt_common-1.30.0.dist-info/RECORD,,
59
+ dbt_common-1.31.0.dist-info/METADATA,sha256=x-HIsYSHb3wM0wLFUwpa6dvgQLJGRmUzcj4qBHAfZBA,4988
60
+ dbt_common-1.31.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
61
+ dbt_common-1.31.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
62
+ dbt_common-1.31.0.dist-info/RECORD,,