dbt-common 1.0.0b2__py3-none-any.whl → 1.0.2__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/constants.py +6 -1
- dbt_common/context.py +7 -2
- dbt_common/events/functions.py +4 -5
- dbt_common/helper_types.py +13 -1
- dbt_common/ui.py +4 -0
- {dbt_common-1.0.0b2.dist-info → dbt_common-1.0.2.dist-info}/METADATA +1 -1
- {dbt_common-1.0.0b2.dist-info → dbt_common-1.0.2.dist-info}/RECORD +10 -10
- {dbt_common-1.0.0b2.dist-info → dbt_common-1.0.2.dist-info}/WHEEL +1 -1
- {dbt_common-1.0.0b2.dist-info → dbt_common-1.0.2.dist-info}/licenses/LICENSE +0 -0
dbt_common/__about__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
version = "1.0.
|
1
|
+
version = "1.0.2"
|
dbt_common/constants.py
CHANGED
@@ -1 +1,6 @@
|
|
1
|
-
|
1
|
+
# Prefix which identifies environment variables which contains secrets.
|
2
|
+
SECRET_ENV_PREFIX = "DBT_ENV_SECRET"
|
3
|
+
|
4
|
+
# Prefix which identifies environment variables that should not be visible
|
5
|
+
# via macros, flags, or other user-facing mechanisms.
|
6
|
+
PRIVATE_ENV_PREFIX = "DBT_ENV_PRIVATE"
|
dbt_common/context.py
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
from contextvars import ContextVar, copy_context
|
2
2
|
from typing import List, Mapping, Optional
|
3
3
|
|
4
|
-
from dbt_common.constants import SECRET_ENV_PREFIX
|
4
|
+
from dbt_common.constants import PRIVATE_ENV_PREFIX, SECRET_ENV_PREFIX
|
5
5
|
|
6
6
|
|
7
7
|
class InvocationContext:
|
8
8
|
def __init__(self, env: Mapping[str, str]):
|
9
|
-
self._env = env
|
9
|
+
self._env = {k: v for k, v in env.items() if not k.startswith(PRIVATE_ENV_PREFIX)}
|
10
10
|
self._env_secrets: Optional[List[str]] = None
|
11
|
+
self._env_private = {k: v for k, v in env.items() if k.startswith(PRIVATE_ENV_PREFIX)}
|
11
12
|
self.recorder = None
|
12
13
|
# This class will also eventually manage the invocation_id, flags, event manager, etc.
|
13
14
|
|
@@ -15,6 +16,10 @@ class InvocationContext:
|
|
15
16
|
def env(self) -> Mapping[str, str]:
|
16
17
|
return self._env
|
17
18
|
|
19
|
+
@property
|
20
|
+
def env_private(self) -> Mapping[str, str]:
|
21
|
+
return self._env_private
|
22
|
+
|
18
23
|
@property
|
19
24
|
def env_secrets(self) -> List[str]:
|
20
25
|
if self._env_secrets is None:
|
dbt_common/events/functions.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
from pathlib import Path
|
2
2
|
|
3
3
|
from dbt_common.events.event_manager_client import get_event_manager
|
4
|
+
from dbt_common.exceptions import EventCompilationError
|
4
5
|
from dbt_common.invocation import get_invocation_id
|
5
6
|
from dbt_common.helper_types import WarnErrorOptions
|
6
7
|
from dbt_common.utils.encoding import ForgivingJSONEncoder
|
@@ -114,12 +115,10 @@ def msg_to_dict(msg: EventMsg) -> dict:
|
|
114
115
|
|
115
116
|
|
116
117
|
def warn_or_error(event, node=None) -> None:
|
117
|
-
|
118
|
-
|
119
|
-
from dbt_common.exceptions import EventCompilationError
|
120
|
-
|
118
|
+
event_name = type(event).__name__
|
119
|
+
if WARN_ERROR or WARN_ERROR_OPTIONS.includes(event_name):
|
121
120
|
raise EventCompilationError(event.message(), node)
|
122
|
-
|
121
|
+
elif not WARN_ERROR_OPTIONS.silenced(event_name):
|
123
122
|
fire_event(event)
|
124
123
|
|
125
124
|
|
dbt_common/helper_types.py
CHANGED
@@ -54,7 +54,7 @@ class IncludeExclude(dbtClassMixin):
|
|
54
54
|
if isinstance(self.exclude, list):
|
55
55
|
self._validate_items(self.exclude)
|
56
56
|
|
57
|
-
def includes(self, item_name: str):
|
57
|
+
def includes(self, item_name: str) -> bool:
|
58
58
|
return (
|
59
59
|
item_name in self.include or self.include in self.INCLUDE_ALL
|
60
60
|
) and item_name not in self.exclude
|
@@ -69,10 +69,22 @@ class WarnErrorOptions(IncludeExclude):
|
|
69
69
|
include: Union[str, List[str]],
|
70
70
|
exclude: Optional[List[str]] = None,
|
71
71
|
valid_error_names: Optional[Set[str]] = None,
|
72
|
+
silence: Optional[List[str]] = None,
|
72
73
|
):
|
74
|
+
self.silence = silence or []
|
73
75
|
self._valid_error_names: Set[str] = valid_error_names or set()
|
74
76
|
super().__init__(include=include, exclude=(exclude or []))
|
75
77
|
|
78
|
+
def __post_init__(self):
|
79
|
+
super().__post_init__()
|
80
|
+
self._validate_items(self.silence)
|
81
|
+
|
82
|
+
def includes(self, item_name: str) -> bool:
|
83
|
+
return super().includes(item_name) and not self.silenced(item_name)
|
84
|
+
|
85
|
+
def silenced(self, item_name: str) -> bool:
|
86
|
+
return item_name in self.silence
|
87
|
+
|
76
88
|
def _validate_items(self, items: List[str]):
|
77
89
|
for item in items:
|
78
90
|
if item not in self._valid_error_names:
|
dbt_common/ui.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: dbt-common
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.2
|
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,15 +1,15 @@
|
|
1
|
-
dbt_common/__about__.py,sha256=
|
1
|
+
dbt_common/__about__.py,sha256=tTF5v0pCQ3wj3WtOg6KXgEGkOMgBeRFQACKUYV29zxo,18
|
2
2
|
dbt_common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
dbt_common/constants.py,sha256
|
4
|
-
dbt_common/context.py,sha256=
|
3
|
+
dbt_common/constants.py,sha256=-Y5DIL1SDPQWtlCNizXRYxFgbx1D7LaLs1ysamvGMRk,278
|
4
|
+
dbt_common/context.py,sha256=BhgT7IgyvpZHEtIdFVVuBBBX5LuU7obXT7NvIPeuD2g,1760
|
5
5
|
dbt_common/dataclass_schema.py,sha256=R8YBju2Z-qRfy5eJa-jYWedS43rXk9P6E9ttofFc9xU,5282
|
6
|
-
dbt_common/helper_types.py,sha256=
|
6
|
+
dbt_common/helper_types.py,sha256=NoxqGFAq9bOjh7rqtz_eepXAxk20n3mmW_gUVpnMyYU,3901
|
7
7
|
dbt_common/invocation.py,sha256=Zw8jRPn75oi2VrUD6qGvaCDtSyIfqm5pJlPpRjs3s1E,202
|
8
8
|
dbt_common/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
dbt_common/record.py,sha256=bQ_1fC5qp_RlQxLXq_wHYl5G37BvkzE0d_F2F39PDUA,7015
|
10
10
|
dbt_common/semver.py,sha256=2zoZYCQ7PfswqslT2NHuMGgPGMuMuX-yRThVoqfDWQU,13954
|
11
11
|
dbt_common/tests.py,sha256=6lC_JuRtoYO6cbAF8-R5aTM4HtQiM_EH8X5m_97duGY,315
|
12
|
-
dbt_common/ui.py,sha256=
|
12
|
+
dbt_common/ui.py,sha256=rc2TEM29raBFc_LXcg901pMDD07C2ohwp9qzkE-7pBY,2567
|
13
13
|
dbt_common/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
14
|
dbt_common/clients/_jinja_blocks.py,sha256=xoJK9Y0F93U2PKfT_3SJbBopCGYCtl7LiwKuylXnrEE,12947
|
15
15
|
dbt_common/clients/agate_helper.py,sha256=n5Q0_gJPbBhFvjd286NGYGlcTtdEExYmIT3968lppyg,9124
|
@@ -31,7 +31,7 @@ dbt_common/events/event_handler.py,sha256=jfi0PyqIOGnXCG9HEa0VIVULqNvXs1RYmAg0b5
|
|
31
31
|
dbt_common/events/event_manager.py,sha256=ZXJ-N4NsfQTnkEpvuedTjHD8Gt8DgYHbz601eTVCm-o,2175
|
32
32
|
dbt_common/events/event_manager_client.py,sha256=etDlUv-3iIwM5IXXuzc1cmQID2fHOXw8dE9snp39-jk,1014
|
33
33
|
dbt_common/events/format.py,sha256=x1RWDZ8G7ZMHmxdld6Q4VXca4kvnhiQOIaQXkC6Uo0Q,1609
|
34
|
-
dbt_common/events/functions.py,sha256=
|
34
|
+
dbt_common/events/functions.py,sha256=K-R-FBTeO03U51gtMBu1EUcNsIAsgw_e5spWxLJ44VE,4762
|
35
35
|
dbt_common/events/helpers.py,sha256=CfsWwNDjsLJkPIgOtAfuLEnZ3rGUKeYsH8aDtCW12OA,410
|
36
36
|
dbt_common/events/interfaces.py,sha256=hEDeDoB0FW2RYHVZBG7gebEt_mUVBzkn1yPubpaxs-s,147
|
37
37
|
dbt_common/events/logger.py,sha256=6LLH8aLoRziFLBmwu-TCR5-EMpBtD28pSaL0FmKpeGA,6159
|
@@ -55,7 +55,7 @@ dbt_common/utils/encoding.py,sha256=6_kSY2FvGNYMg7oX7PrbvVioieydih3Kl7Ii802LaHI,
|
|
55
55
|
dbt_common/utils/executor.py,sha256=Zyzd1wML3aN-iYn9ZG2Gc_jj5vknmvQNyH-c0RaPIpo,2446
|
56
56
|
dbt_common/utils/formatting.py,sha256=JUn5rzJ-uajs9wPCN0-f2iRFY1pOJF5YjTD9dERuLoc,165
|
57
57
|
dbt_common/utils/jinja.py,sha256=XNfZHuZhLM_R_yPmzYojPm6bF7QOoxIjSWrkJRw6wks,965
|
58
|
-
dbt_common-1.0.
|
59
|
-
dbt_common-1.0.
|
60
|
-
dbt_common-1.0.
|
61
|
-
dbt_common-1.0.
|
58
|
+
dbt_common-1.0.2.dist-info/METADATA,sha256=IebudTb4QFzByGUjmt4oAApNfCHCksNfwyml2EE3058,5219
|
59
|
+
dbt_common-1.0.2.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
|
60
|
+
dbt_common-1.0.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
61
|
+
dbt_common-1.0.2.dist-info/RECORD,,
|
File without changes
|