fabricks 3.0.14__py3-none-any.whl → 3.0.16__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.
- fabricks/context/helpers.py +1 -1
- fabricks/core/masks.py +8 -5
- fabricks/core/udfs.py +13 -5
- fabricks/deploy/__init__.py +4 -4
- fabricks/deploy/masks.py +2 -2
- fabricks/deploy/tables.py +3 -3
- fabricks/deploy/udfs.py +2 -2
- {fabricks-3.0.14.dist-info → fabricks-3.0.16.dist-info}/METADATA +1 -1
- {fabricks-3.0.14.dist-info → fabricks-3.0.16.dist-info}/RECORD +10 -10
- {fabricks-3.0.14.dist-info → fabricks-3.0.16.dist-info}/WHEEL +0 -0
fabricks/context/helpers.py
CHANGED
fabricks/core/masks.py
CHANGED
|
@@ -7,7 +7,7 @@ from fabricks.context import CATALOG, PATH_MASKS, SPARK
|
|
|
7
7
|
from fabricks.context.log import DEFAULT_LOGGER
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
def register_all_masks():
|
|
10
|
+
def register_all_masks(override: bool = False):
|
|
11
11
|
"""
|
|
12
12
|
Register all masks.
|
|
13
13
|
"""
|
|
@@ -16,7 +16,7 @@ def register_all_masks():
|
|
|
16
16
|
for mask in get_masks():
|
|
17
17
|
split = mask.split(".")
|
|
18
18
|
try:
|
|
19
|
-
register_mask(mask=split[0])
|
|
19
|
+
register_mask(mask=split[0], override=override)
|
|
20
20
|
except Exception as e:
|
|
21
21
|
DEFAULT_LOGGER.exception(f"could not register mask {mask}", exc_info=e)
|
|
22
22
|
|
|
@@ -40,13 +40,16 @@ def is_registered(mask: str, spark: Optional[SparkSession] = None) -> bool:
|
|
|
40
40
|
return not df.isEmpty()
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
def register_mask(mask: str, spark: Optional[SparkSession] = None):
|
|
43
|
+
def register_mask(mask: str, override: Optional[bool] = False, spark: Optional[SparkSession] = None):
|
|
44
44
|
if spark is None:
|
|
45
45
|
spark = SPARK
|
|
46
46
|
assert spark is not None
|
|
47
47
|
|
|
48
|
-
if not is_registered(mask, spark):
|
|
49
|
-
|
|
48
|
+
if not is_registered(mask, spark) or override:
|
|
49
|
+
if override:
|
|
50
|
+
DEFAULT_LOGGER.debug(f"override mask {mask}")
|
|
51
|
+
else:
|
|
52
|
+
DEFAULT_LOGGER.debug(f"register mask {mask}")
|
|
50
53
|
|
|
51
54
|
path = PATH_MASKS.joinpath(f"{mask}.sql")
|
|
52
55
|
spark.sql(path.get_sql())
|
fabricks/core/udfs.py
CHANGED
|
@@ -11,7 +11,7 @@ from fabricks.context.log import DEFAULT_LOGGER
|
|
|
11
11
|
UDFS: dict[str, Callable] = {}
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
def register_all_udfs(extension: Optional[str] = None):
|
|
14
|
+
def register_all_udfs(extension: Optional[str] = None, override: bool = False):
|
|
15
15
|
"""
|
|
16
16
|
Register all user-defined functions (UDFs).
|
|
17
17
|
"""
|
|
@@ -20,7 +20,7 @@ def register_all_udfs(extension: Optional[str] = None):
|
|
|
20
20
|
for udf in get_udfs(extension=extension):
|
|
21
21
|
split = udf.split(".")
|
|
22
22
|
try:
|
|
23
|
-
register_udf(udf=split[0], extension=split[1])
|
|
23
|
+
register_udf(udf=split[0], extension=split[1], override=override)
|
|
24
24
|
except Exception as e:
|
|
25
25
|
DEFAULT_LOGGER.exception(f"could not register udf {udf}", exc_info=e)
|
|
26
26
|
|
|
@@ -57,7 +57,12 @@ def is_registered(udf: str, spark: Optional[SparkSession] = None) -> bool:
|
|
|
57
57
|
return not df.isEmpty()
|
|
58
58
|
|
|
59
59
|
|
|
60
|
-
def register_udf(
|
|
60
|
+
def register_udf(
|
|
61
|
+
udf: str,
|
|
62
|
+
extension: Optional[str] = None,
|
|
63
|
+
override: Optional[bool] = False,
|
|
64
|
+
spark: Optional[SparkSession] = None,
|
|
65
|
+
):
|
|
61
66
|
"""
|
|
62
67
|
Register a user-defined function (UDF).
|
|
63
68
|
"""
|
|
@@ -65,8 +70,11 @@ def register_udf(udf: str, extension: Optional[str] = None, spark: Optional[Spar
|
|
|
65
70
|
spark = SPARK
|
|
66
71
|
assert spark is not None
|
|
67
72
|
|
|
68
|
-
if not is_registered(udf, spark):
|
|
69
|
-
|
|
73
|
+
if not is_registered(udf, spark) or override:
|
|
74
|
+
if override:
|
|
75
|
+
DEFAULT_LOGGER.debug(f"override udf {udf}")
|
|
76
|
+
else:
|
|
77
|
+
DEFAULT_LOGGER.debug(f"register udf {udf}")
|
|
70
78
|
|
|
71
79
|
if extension is None:
|
|
72
80
|
extension = get_extension(udf)
|
fabricks/deploy/__init__.py
CHANGED
|
@@ -25,12 +25,12 @@ class Deploy:
|
|
|
25
25
|
deploy_views()
|
|
26
26
|
|
|
27
27
|
@staticmethod
|
|
28
|
-
def udfs():
|
|
29
|
-
deploy_udfs()
|
|
28
|
+
def udfs(override: bool = True):
|
|
29
|
+
deploy_udfs(override=override)
|
|
30
30
|
|
|
31
31
|
@staticmethod
|
|
32
|
-
def masks():
|
|
33
|
-
deploy_masks()
|
|
32
|
+
def masks(override: bool = True):
|
|
33
|
+
deploy_masks(override=override)
|
|
34
34
|
|
|
35
35
|
@staticmethod
|
|
36
36
|
def notebooks():
|
fabricks/deploy/masks.py
CHANGED
|
@@ -2,7 +2,7 @@ from fabricks.context.log import DEFAULT_LOGGER
|
|
|
2
2
|
from fabricks.core.masks import register_all_masks
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
def deploy_masks():
|
|
5
|
+
def deploy_masks(override: bool = True):
|
|
6
6
|
DEFAULT_LOGGER.info("create or replace masks")
|
|
7
7
|
|
|
8
|
-
register_all_masks()
|
|
8
|
+
register_all_masks(override=override)
|
fabricks/deploy/tables.py
CHANGED
|
@@ -9,9 +9,9 @@ from fabricks.metastore.table import Table
|
|
|
9
9
|
def deploy_tables(drop: bool = False):
|
|
10
10
|
DEFAULT_LOGGER.info("create or replace fabricks (default) tables")
|
|
11
11
|
|
|
12
|
-
create_table_log(drop)
|
|
13
|
-
create_table_dummy(drop)
|
|
14
|
-
create_table_step(drop)
|
|
12
|
+
create_table_log(drop=drop)
|
|
13
|
+
create_table_dummy(drop=drop)
|
|
14
|
+
create_table_step(drop=drop)
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
def create_table_step(drop: bool = False):
|
fabricks/deploy/udfs.py
CHANGED
|
@@ -4,10 +4,10 @@ from fabricks.core.udfs import register_all_udfs
|
|
|
4
4
|
from fabricks.utils.sqlglot import fix as fix_sql
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
def deploy_udfs():
|
|
7
|
+
def deploy_udfs(override: bool = True):
|
|
8
8
|
DEFAULT_LOGGER.info("create or replace udfs")
|
|
9
9
|
|
|
10
|
-
register_all_udfs(extension="sql")
|
|
10
|
+
register_all_udfs(extension="sql", override=override)
|
|
11
11
|
create_or_replace_udf_job_id()
|
|
12
12
|
|
|
13
13
|
|
|
@@ -70,7 +70,7 @@ fabricks/cdc/templates/queries/nocdc/update.sql.jinja,sha256=mjNUwGVhZ08yUkdv9sC
|
|
|
70
70
|
fabricks/context/__init__.py,sha256=qfntJ9O6omzY_t6AhDP6Ndu9C5LMiVdWbo6ikhtoe7o,1446
|
|
71
71
|
fabricks/context/_types.py,sha256=FzQJ35vp0uc6pAq18bc-VHwMVEWtd0VDdm8xQmNr2Sg,2681
|
|
72
72
|
fabricks/context/config.py,sha256=EmLUnswuWfrncaNJMDjvdMg-1lD8aneKAY8IDna7VPE,4814
|
|
73
|
-
fabricks/context/helpers.py,sha256=
|
|
73
|
+
fabricks/context/helpers.py,sha256=igY8LwLIxzfOWKCg23XMsJoY7Bw0welpdNry2mKHjF0,1600
|
|
74
74
|
fabricks/context/log.py,sha256=CadrRf8iL6iXlGIGIhEIswa7wGqC-E-oLwWcGTyJ10s,2074
|
|
75
75
|
fabricks/context/runtime.py,sha256=87PtX6SqLoFd0PGxgisF6dLlxtCHaHxkMMIt34UyB2w,3479
|
|
76
76
|
fabricks/context/secret.py,sha256=iRM-KU-JcJAEOLoGJ8S4Oh65-yt674W6CDTSkOE7SXw,3192
|
|
@@ -79,8 +79,8 @@ fabricks/context/utils.py,sha256=EQRscdUhdjwk2htZu8gCgNZ9PfRzzrR6e1kRrIbVlBM,278
|
|
|
79
79
|
fabricks/core/__init__.py,sha256=LaqDi4xuyHAoLOvS44PQdZdRfq9SmVr7mB6BDHyxYpc,209
|
|
80
80
|
fabricks/core/extenders.py,sha256=oJzfv0hWxusnGmrjMwbrGyKfot8xzA4XtNquPWfFgPo,727
|
|
81
81
|
fabricks/core/job_schema.py,sha256=6-70oy0ZJd3V9AiXfc0Q8b8NVEynxQza_h7mB13uB-s,853
|
|
82
|
-
fabricks/core/masks.py,sha256=
|
|
83
|
-
fabricks/core/udfs.py,sha256=
|
|
82
|
+
fabricks/core/masks.py,sha256=0ARgXE6stazRlfjE2v2sOdQWjAH2TbCOgtuD33BeZqE,1531
|
|
83
|
+
fabricks/core/udfs.py,sha256=QlFOgN-Ceiv601-2O2sPXfSMqYYZiL29GvUkTfx_P0k,3163
|
|
84
84
|
fabricks/core/views.py,sha256=52tekqeP0Xk5EPYO220YdfFbzItX6NnObROb-ye9COQ,1181
|
|
85
85
|
fabricks/core/dags/__init__.py,sha256=0DUKzVcXcROvxkN19P_kaOJ7da5BAM7Vt8EGQbp2KSY,240
|
|
86
86
|
fabricks/core/dags/base.py,sha256=tFj27SqeZUZ7pB_LOWkpdowZz5gj30JUANI4gWK3Pl8,3139
|
|
@@ -129,12 +129,12 @@ fabricks/core/steps/_types.py,sha256=VxIrH3nFwmPlwG-UI8sDDP0AwK_9jlsy6yQp6YfgtqE
|
|
|
129
129
|
fabricks/core/steps/base.py,sha256=MJe2q9s1siM89YkpHDqldtbtKQgkhDB_cFa2-e_irvs,14642
|
|
130
130
|
fabricks/core/steps/get_step.py,sha256=8q4rEDdTTZNJsXB2l5XY-Ktoow8ZHsON_tx5yKMUIzg,284
|
|
131
131
|
fabricks/core/steps/get_step_conf.py,sha256=UPT3gB1Sh5yzawZ9qiVQlvVAKaxPX82gaWBDzxx75EM,633
|
|
132
|
-
fabricks/deploy/__init__.py,sha256=
|
|
133
|
-
fabricks/deploy/masks.py,sha256=
|
|
132
|
+
fabricks/deploy/__init__.py,sha256=G4U3gLVFBkedqH28dVsIee5D_hzhKZOP3FFJ9ygaNvU,2451
|
|
133
|
+
fabricks/deploy/masks.py,sha256=exf6UMutruHozw6oZY98DNAn464npbQlwN5-G22vDn8,236
|
|
134
134
|
fabricks/deploy/notebooks.py,sha256=pfmD1K-TCOuuxttEK45Ti1RDc-_nIOmWlb2EWr1Vp28,1545
|
|
135
135
|
fabricks/deploy/schedules.py,sha256=0a5dU1rW6fg8aAp7TTt-l0DgR-4kmzsX2xxV2C30yaw,347
|
|
136
|
-
fabricks/deploy/tables.py,sha256=
|
|
137
|
-
fabricks/deploy/udfs.py,sha256=
|
|
136
|
+
fabricks/deploy/tables.py,sha256=F_A3_BIf0x5GcWaBVMqrLG-GUOa7W3RSF2m-1ppxUgo,2636
|
|
137
|
+
fabricks/deploy/udfs.py,sha256=rBEzFKG_a9TKERceTLRC3b-2BjNe1YEIwU2r0I4EecE,637
|
|
138
138
|
fabricks/deploy/utils.py,sha256=V41r1zVT9KcsICqTLAzpb4ixRk2q2ybJMrGhkPOtG6k,5099
|
|
139
139
|
fabricks/deploy/views.py,sha256=8cSt6IzZy-JHHkyqd91NT2hi3LTNTOolimlfSBXMCvU,14434
|
|
140
140
|
fabricks/metastore/README.md,sha256=utPUGAxmjyNMGe43GfL0Gup4MjeTKKwyiUoNVSfMquI,51
|
|
@@ -171,6 +171,6 @@ fabricks/utils/schema/get_schema_for_type.py,sha256=5k-R6zCgUAtapQgxT4turcx1IQ-b
|
|
|
171
171
|
fabricks/utils/write/__init__.py,sha256=i0UnZenXj9Aq0b0_aU3s6882vg-Vu_AyKfQhl_dTp-g,200
|
|
172
172
|
fabricks/utils/write/delta.py,sha256=lTQ0CfUhcvn3xTCcT_Ns6PMDBsO5UEfa2S9XpJiLJ9c,1250
|
|
173
173
|
fabricks/utils/write/stream.py,sha256=wQBpAnQtYA6nl79sPKhVM6u5m-66suX7B6VQ6tW4TOs,622
|
|
174
|
-
fabricks-3.0.
|
|
175
|
-
fabricks-3.0.
|
|
176
|
-
fabricks-3.0.
|
|
174
|
+
fabricks-3.0.16.dist-info/METADATA,sha256=EUzxCf5zxbG8Dmst3_r4jyjK4Xb78n3pY0gajpZwqrg,798
|
|
175
|
+
fabricks-3.0.16.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
176
|
+
fabricks-3.0.16.dist-info/RECORD,,
|
|
File without changes
|