fabricks 3.0.6__py3-none-any.whl → 3.0.8__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.
@@ -16,8 +16,7 @@
16
16
  {% for output in outputs %} c.`{{ output }}`, {% endfor %}
17
17
  from __current c
18
18
  left anti join
19
- {{ parent_cdc }} s on s.__key == c.__key and s.__hash == c.__hash
20
- {% if has_source %} and s.__source = c.__source {% endif %}
19
+ {{ parent_cdc }} s on s.__key == c.__key {% if has_source %} and s.__source = c.__source {% endif %}
21
20
  {% endif %}
22
21
  ),
23
22
  {% else %}
fabricks/context/utils.py CHANGED
@@ -4,7 +4,7 @@ import fabricks.context.config as c
4
4
  import fabricks.context.runtime as r
5
5
 
6
6
 
7
- def pprint_runtime():
7
+ def pprint_runtime(extended: bool = False) -> None:
8
8
  print("=" * 60)
9
9
  print("FABRICKS RUNTIME CONFIGURATION")
10
10
  print("=" * 60)
@@ -50,27 +50,31 @@ def pprint_runtime():
50
50
  print("\n🔐 SECURITY:")
51
51
  print(f" Secret Scope: {r.SECRET_SCOPE}")
52
52
 
53
- # Component Paths Section
54
- print("\n🛠️ COMPONENT PATHS:")
55
- components = [
56
- ("UDFs", r.PATH_UDFS),
57
- ("Parsers", r.PATH_PARSERS),
58
- ("Extenders", r.PATH_EXTENDERS),
59
- ("Views", r.PATH_VIEWS),
60
- ("Schedules", r.PATH_SCHEDULES),
61
- ]
53
+ print("\n🌐 ADDITIONAL SETTINGS:")
54
+ print(f" Timezone: {r.TIMEZONE}")
62
55
 
63
- for name, path in components:
64
- print(f" {name}: {path.string}")
56
+ if extended:
57
+ # Component Paths Section
58
+ print("\n🛠️ COMPONENT PATHS:")
59
+ components = [
60
+ ("UDFs", r.PATH_UDFS),
61
+ ("Parsers", r.PATH_PARSERS),
62
+ ("Extenders", r.PATH_EXTENDERS),
63
+ ("Views", r.PATH_VIEWS),
64
+ ("Schedules", r.PATH_SCHEDULES),
65
+ ]
65
66
 
66
- # Storage Paths Section
67
- print("\n📦 STORAGE PATHS:")
68
- for name, path in sorted(r.PATHS_STORAGE.items()):
69
- icon = "🏭" if name == "fabricks" else "📊"
70
- print(f" {icon} {name}: {path.string}")
67
+ for name, path in components:
68
+ print(f" {name}: {path.string}")
71
69
 
72
- # Runtime Paths Section
73
- if r.PATHS_RUNTIME:
74
- print("\n⚡ RUNTIME PATHS:")
75
- for name, path in sorted(r.PATHS_RUNTIME.items()):
76
- print(f" 📂 {name}: {path.string}")
70
+ # Storage Paths Section
71
+ print("\n📦 STORAGE PATHS:")
72
+ for name, path in sorted(r.PATHS_STORAGE.items()):
73
+ icon = "🏭" if name == "fabricks" else "📊"
74
+ print(f" {icon} {name}: {path.string}")
75
+
76
+ # Runtime Paths Section
77
+ if r.PATHS_RUNTIME:
78
+ print("\n⚡ RUNTIME PATHS:")
79
+ for name, path in sorted(r.PATHS_RUNTIME.items()):
80
+ print(f" 📂 {name}: {path.string}")
@@ -13,7 +13,7 @@ from fabricks.core.jobs.base.job import BaseJob
13
13
  from fabricks.core.udfs import is_registered, register_udf
14
14
  from fabricks.metastore.view import create_or_replace_global_temp_view
15
15
  from fabricks.utils.path import Path
16
- from fabricks.utils.sqlglot import get_tables
16
+ from fabricks.utils.sqlglot import fix, get_tables
17
17
 
18
18
 
19
19
  class Gold(BaseJob):
@@ -68,7 +68,8 @@ class Gold(BaseJob):
68
68
 
69
69
  @property
70
70
  def sql(self) -> str:
71
- return self.paths.runtime.get_sql()
71
+ sql = self.paths.runtime.get_sql()
72
+ return fix(sql)
72
73
 
73
74
  @deprecated("use sql instead")
74
75
  def get_sql(self) -> str:
@@ -9,6 +9,8 @@ def get_dependencies(name: str) -> DataFrame:
9
9
 
10
10
 
11
11
  def get_mermaid_diagram(name: str) -> str:
12
+ from fabricks.utils.mermaid import get_mermaid_diagram as get_diagram
13
+
12
14
  df = get_dependencies(name)
13
15
 
14
16
  df = df.withColumnRenamed("ParentId", "parent_id")
@@ -16,31 +18,4 @@ def get_mermaid_diagram(name: str) -> str:
16
18
  df = df.withColumnRenamed("JobId", "job_id")
17
19
  df = df.withColumnRenamed("Job", "job")
18
20
 
19
- dependencies = df.select("parent_id", "parent", "job_id", "job").collect()
20
-
21
- out = "flowchart TD\n"
22
-
23
- unique_nodes = set()
24
-
25
- for row in dependencies:
26
- parent_id = str(row["parent_id"])
27
- parent_name = str(row["parent"])
28
- child_id = str(row["job_id"])
29
- child_name = str(row["job"])
30
-
31
- if parent_id != "0" and parent_id is not None:
32
- if parent_id not in unique_nodes:
33
- out += f" {parent_id}[{parent_name}]\n"
34
- unique_nodes.add(parent_id)
35
-
36
- if child_id not in unique_nodes:
37
- out += f" {child_id}[{child_name}]\n"
38
- unique_nodes.add(child_id)
39
-
40
- out += f" {parent_id} --> {child_id}\n"
41
- else:
42
- if child_id not in unique_nodes:
43
- out += f" {child_id}[{child_name}]\n"
44
- unique_nodes.add(child_id)
45
-
46
- return out
21
+ return get_diagram(df)
@@ -0,0 +1,32 @@
1
+ from pyspark.sql import DataFrame
2
+
3
+
4
+ def get_mermaid_diagram(df: DataFrame) -> str:
5
+ dependencies = df.select("parent_id", "parent", "job_id", "job").collect()
6
+
7
+ out = "flowchart TD\n"
8
+
9
+ unique_nodes = set()
10
+
11
+ for row in dependencies:
12
+ parent_id = str(row["parent_id"])
13
+ parent_name = str(row["parent"])
14
+ child_id = str(row["job_id"])
15
+ child_name = str(row["job"])
16
+
17
+ if parent_id != "0" and parent_id is not None:
18
+ if parent_id not in unique_nodes:
19
+ out += f" {parent_id}[{parent_name}]\n"
20
+ unique_nodes.add(parent_id)
21
+
22
+ if child_id not in unique_nodes:
23
+ out += f" {child_id}[{child_name}]\n"
24
+ unique_nodes.add(child_id)
25
+
26
+ out += f" {parent_id} --> {child_id}\n"
27
+ else:
28
+ if child_id not in unique_nodes:
29
+ out += f" {child_id}[{child_name}]\n"
30
+ unique_nodes.add(child_id)
31
+
32
+ return out
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fabricks
3
- Version: 3.0.6
3
+ Version: 3.0.8
4
4
  Author-email: BMS DWH Team <bi_support@bmsuisse.ch>
5
5
  Requires-Python: <4,>=3.9
6
6
  Requires-Dist: azure-data-tables<13,>=12.5.0
@@ -66,14 +66,14 @@ fabricks/cdc/templates/queries/final.sql.jinja,sha256=vxH434CO5k8Ia7tugaH8LC1co7
66
66
  fabricks/cdc/templates/queries/scd1.sql.jinja,sha256=siHULgKE3uRBGQYZFUR_eHNqFuGgO9xUCRVV2jnAXAI,3019
67
67
  fabricks/cdc/templates/queries/scd2.sql.jinja,sha256=Nn0wUs9N-_QviZqUKRWAFdD17RR3EFBTMs9BpBu6z7E,3877
68
68
  fabricks/cdc/templates/queries/nocdc/complete.sql.jinja,sha256=cVKKCSbiuuw1K7BOzfusX6KvzQNHU3YNUgoXgsu-c6k,267
69
- fabricks/cdc/templates/queries/nocdc/update.sql.jinja,sha256=aqrumQp07lX5l2Bi9gmFSyu7cYO6rv8oPw2E2wJSUtM,1324
69
+ fabricks/cdc/templates/queries/nocdc/update.sql.jinja,sha256=mjNUwGVhZ08yUkdv9sCTkqyW60p0YavtWTqvSUVrwjA,1283
70
70
  fabricks/context/__init__.py,sha256=qfntJ9O6omzY_t6AhDP6Ndu9C5LMiVdWbo6ikhtoe7o,1446
71
71
  fabricks/context/_types.py,sha256=FzQJ35vp0uc6pAq18bc-VHwMVEWtd0VDdm8xQmNr2Sg,2681
72
72
  fabricks/context/log.py,sha256=CadrRf8iL6iXlGIGIhEIswa7wGqC-E-oLwWcGTyJ10s,2074
73
73
  fabricks/context/runtime.py,sha256=7pXU_5gPyvChwiyxP4ch59eAgyoNOH9jMUlGWxwXWn8,3915
74
74
  fabricks/context/secret.py,sha256=LEx7MXSFm29wvsBffNSIQ6p73wqqmFj2jmU2y64h-Fc,3191
75
75
  fabricks/context/spark_session.py,sha256=BPaxKJXHZDI5oQiOPhmua_xjXnrVgluh--AVpvUgbck,2553
76
- fabricks/context/utils.py,sha256=Wq-soZ2iSAPly0DulNNuOniguOzAnf2-o2tBkPTSazE,2573
76
+ fabricks/context/utils.py,sha256=EQRscdUhdjwk2htZu8gCgNZ9PfRzzrR6e1kRrIbVlBM,2786
77
77
  fabricks/context/config/__init__.py,sha256=pFEsGXBQkX5_FP0cwQMX427j6dQuTx81NR9snMxc8cU,3127
78
78
  fabricks/context/config/utils.py,sha256=7KCTUiSbqQnDD5mbCO9_o1KbUgD-Xbei_UGgpMQi9nE,1371
79
79
  fabricks/core/__init__.py,sha256=LaqDi4xuyHAoLOvS44PQdZdRfq9SmVr7mB6BDHyxYpc,209
@@ -98,7 +98,7 @@ fabricks/core/jobs/get_job_id.py,sha256=6dLyzxGHlRvJZVJSwZkCk3iXzWkIhePC_6FhoP0g
98
98
  fabricks/core/jobs/get_jobs.py,sha256=nJ-8DPFq1GyzWo9Mxlwq2dEeAqwg1jeQg-CHietAb1Q,3341
99
99
  fabricks/core/jobs/get_schedule.py,sha256=46pJR5LWZfuxUtLBmtB-RP6ng_W-K-ahJmD29KNmcGw,259
100
100
  fabricks/core/jobs/get_schedules.py,sha256=kryDUBrBrtAaMp8Ou5YqMOCOMKvg1GmbbOQBtiiRleM,794
101
- fabricks/core/jobs/gold.py,sha256=HzeuuOtsjr3lsasBJ1ODzLQzcoanhbzZiP6a9acNsnA,14503
101
+ fabricks/core/jobs/gold.py,sha256=6f2M7ExQNpgNxHGNaM3ut7PAbHp9pftT_Eq8q6whM38,14531
102
102
  fabricks/core/jobs/silver.py,sha256=kdrCBfh1jkhWJUFubGUV4kxan5eRUZl-LI-iSJxyJE4,13093
103
103
  fabricks/core/jobs/base/__init__.py,sha256=_AdWtyL7yZG2TOZ9e8WyNPrOjmm6EDkI_TNym5cLDws,208
104
104
  fabricks/core/jobs/base/_types.py,sha256=y66BtJlJskq7wGzn7te5XYjO-NEqeQGUC11kkbew8AU,8405
@@ -116,7 +116,7 @@ fabricks/core/parsers/decorator.py,sha256=kn_Mj-JLWTFaRiciZ3KavmSUcWFPY3ve-buMru
116
116
  fabricks/core/parsers/get_parser.py,sha256=TTnVPwKqKpFu6jJJnXEuiEctWGtimk8w2p1jF2U7ibg,909
117
117
  fabricks/core/parsers/utils.py,sha256=qdn2ElpqBgDsW55-tACWZaFOT0ebrBYg2fenqSgd6YI,2456
118
118
  fabricks/core/schedules/__init__.py,sha256=bDjNMcm7itimAo4gun0W4W9bZKwZmWUjkMqAQIcqI2Y,431
119
- fabricks/core/schedules/diagrams.py,sha256=DoQR80DLs0CQpUzxscBeO1mWNjgx8btBWaqcj2EFOBc,1379
119
+ fabricks/core/schedules/diagrams.py,sha256=YA4T7Etl_UPfW-3IGFq5Xj9OlXZGQ27Aot6RVa3ZUgg,578
120
120
  fabricks/core/schedules/generate.py,sha256=aKnAe7ZCafAczLa4ka9Er_oltOxgXyNoS63_OZEktcE,623
121
121
  fabricks/core/schedules/get_schedule.py,sha256=PJcEq4enlsRJunS-MjXi-VFIczbeuBStP2giZ_-EaRc,116
122
122
  fabricks/core/schedules/get_schedules.py,sha256=b6KSl-QmiNgih2l6dESB0va9yDVxaGOJ_ZB96Wc3NC8,174
@@ -154,6 +154,7 @@ fabricks/utils/console.py,sha256=X4lLgL_UxCjoFRx-ZRCwzdBveRGPKlFYZDi6vl7uevQ,101
154
154
  fabricks/utils/fdict.py,sha256=cdnvNBSXKJIDKSdhQGJA4CGv0qLn5IVYKQ111l7nM9I,7978
155
155
  fabricks/utils/helpers.py,sha256=h7SuOVpBP5qcgX1nM1suvkXG9BhiK5-257EBepCvrO8,7452
156
156
  fabricks/utils/log.py,sha256=LCQEM81PhdojiyLrtEzv1QM__bWbaEhGddyd0IqyGXM,7985
157
+ fabricks/utils/mermaid.py,sha256=XoiVxPaUJS4TC_ybA-e78qFzQkQ46uPf055JiiNDdSg,986
157
158
  fabricks/utils/path.py,sha256=Bs3PayWtg62-mrsDbvu8kh0VLZZhX7tU9YiyHFiYNhs,6698
158
159
  fabricks/utils/pip.py,sha256=UHo7NTjFGJNghWBuuDow28xUkZYg2YrlbAP49IxZyXY,1522
159
160
  fabricks/utils/pydantic.py,sha256=W0fiDLVMFrrInfQw2s5YPeSEvkN-4k864u3UyPoHaz4,2516
@@ -170,6 +171,6 @@ fabricks/utils/schema/get_schema_for_type.py,sha256=5k-R6zCgUAtapQgxT4turcx1IQ-b
170
171
  fabricks/utils/write/__init__.py,sha256=i0UnZenXj9Aq0b0_aU3s6882vg-Vu_AyKfQhl_dTp-g,200
171
172
  fabricks/utils/write/delta.py,sha256=lTQ0CfUhcvn3xTCcT_Ns6PMDBsO5UEfa2S9XpJiLJ9c,1250
172
173
  fabricks/utils/write/stream.py,sha256=wQBpAnQtYA6nl79sPKhVM6u5m-66suX7B6VQ6tW4TOs,622
173
- fabricks-3.0.6.dist-info/METADATA,sha256=6Rmztba-M06QYN9QXzCHSsvDjyLQIIHtgItpeWtb4zY,761
174
- fabricks-3.0.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
175
- fabricks-3.0.6.dist-info/RECORD,,
174
+ fabricks-3.0.8.dist-info/METADATA,sha256=CdU2wckt0l8lPw2UlOCr8X9ebju9-QkIzPvTQKM_2Mo,761
175
+ fabricks-3.0.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
176
+ fabricks-3.0.8.dist-info/RECORD,,