dbt-common 0.1.3__py3-none-any.whl → 0.1.4__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/context.py +16 -3
- {dbt_common-0.1.3.dist-info → dbt_common-0.1.4.dist-info}/METADATA +1 -1
- {dbt_common-0.1.3.dist-info → dbt_common-0.1.4.dist-info}/RECORD +6 -6
- {dbt_common-0.1.3.dist-info → dbt_common-0.1.4.dist-info}/WHEEL +0 -0
- {dbt_common-0.1.3.dist-info → dbt_common-0.1.4.dist-info}/licenses/LICENSE +0 -0
dbt_common/__about__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
version = "0.1.
|
1
|
+
version = "0.1.4"
|
dbt_common/context.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from contextvars import ContextVar
|
1
|
+
from contextvars import ContextVar, copy_context
|
2
2
|
from typing import List, Mapping, Optional
|
3
3
|
|
4
4
|
from dbt_common.constants import SECRET_ENV_PREFIX
|
@@ -26,10 +26,23 @@ class InvocationContext:
|
|
26
26
|
_INVOCATION_CONTEXT_VAR: ContextVar[InvocationContext] = ContextVar("DBT_INVOCATION_CONTEXT_VAR")
|
27
27
|
|
28
28
|
|
29
|
+
def _reliably_get_invocation_var() -> ContextVar:
|
30
|
+
invocation_var: Optional[ContextVar] = next(
|
31
|
+
(cv for cv in copy_context() if cv.name == _INVOCATION_CONTEXT_VAR.name), None
|
32
|
+
)
|
33
|
+
|
34
|
+
if invocation_var is None:
|
35
|
+
invocation_var = _INVOCATION_CONTEXT_VAR
|
36
|
+
|
37
|
+
return invocation_var
|
38
|
+
|
39
|
+
|
29
40
|
def set_invocation_context(env: Mapping[str, str]) -> None:
|
30
|
-
|
41
|
+
invocation_var = _reliably_get_invocation_var()
|
42
|
+
invocation_var.set(InvocationContext(env))
|
31
43
|
|
32
44
|
|
33
45
|
def get_invocation_context() -> InvocationContext:
|
34
|
-
|
46
|
+
invocation_var = _reliably_get_invocation_var()
|
47
|
+
ctx = invocation_var.get()
|
35
48
|
return ctx
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: dbt-common
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.4
|
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,7 +1,7 @@
|
|
1
|
-
dbt_common/__about__.py,sha256
|
1
|
+
dbt_common/__about__.py,sha256=tVHHGZCNoOKftKv7v8sDg-78N6kJHq-L6dpD2WYhuH8,18
|
2
2
|
dbt_common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
dbt_common/constants.py,sha256=DJIVuTBl5OZpjdFINHon8MNj_XT-Rrp41dAoAuQL2QI,38
|
4
|
-
dbt_common/context.py,sha256=
|
4
|
+
dbt_common/context.py,sha256=ZMmamMuz2CAlIgpoLuNrsl0qGdwPOOQ627R5uBkkvhs,1456
|
5
5
|
dbt_common/dataclass_schema.py,sha256=CRSQQmzY4QIBzL54aomPT34o3u8T6Zu6W1XZmWfKs-A,5254
|
6
6
|
dbt_common/helper_types.py,sha256=jW5Yv0Gwx4M14IEX4RID7k4s0hJiKHIzU8CxACQ1Y7k,3491
|
7
7
|
dbt_common/invocation.py,sha256=Zw8jRPn75oi2VrUD6qGvaCDtSyIfqm5pJlPpRjs3s1E,202
|
@@ -54,7 +54,7 @@ dbt_common/utils/encoding.py,sha256=6_kSY2FvGNYMg7oX7PrbvVioieydih3Kl7Ii802LaHI,
|
|
54
54
|
dbt_common/utils/executor.py,sha256=f8TqNi8PpRI-lC0Qu2Mlfi5BeJEn-Vgk4PM_FnO94dU,2016
|
55
55
|
dbt_common/utils/formatting.py,sha256=JUn5rzJ-uajs9wPCN0-f2iRFY1pOJF5YjTD9dERuLoc,165
|
56
56
|
dbt_common/utils/jinja.py,sha256=XNfZHuZhLM_R_yPmzYojPm6bF7QOoxIjSWrkJRw6wks,965
|
57
|
-
dbt_common-0.1.
|
58
|
-
dbt_common-0.1.
|
59
|
-
dbt_common-0.1.
|
60
|
-
dbt_common-0.1.
|
57
|
+
dbt_common-0.1.4.dist-info/METADATA,sha256=JL0lNeTie1Lv_UaFX_IZSeJ2YA6xPanXPzHxrVmNR2Q,3648
|
58
|
+
dbt_common-0.1.4.dist-info/WHEEL,sha256=TJPnKdtrSue7xZ_AVGkp9YXcvDrobsjBds1du3Nx6dc,87
|
59
|
+
dbt_common-0.1.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
60
|
+
dbt_common-0.1.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|