semantic-link-labs 0.8.5__py3-none-any.whl → 0.8.7__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.
Potentially problematic release.
This version of semantic-link-labs might be problematic. Click here for more details.
- {semantic_link_labs-0.8.5.dist-info → semantic_link_labs-0.8.7.dist-info}/METADATA +15 -6
- {semantic_link_labs-0.8.5.dist-info → semantic_link_labs-0.8.7.dist-info}/RECORD +36 -30
- {semantic_link_labs-0.8.5.dist-info → semantic_link_labs-0.8.7.dist-info}/WHEEL +1 -1
- sempy_labs/__init__.py +37 -6
- sempy_labs/_authentication.py +108 -0
- sempy_labs/_connections.py +355 -176
- sempy_labs/_dataflows.py +0 -1
- sempy_labs/_gateways.py +439 -0
- sempy_labs/_generate_semantic_model.py +51 -30
- sempy_labs/_git.py +13 -5
- sempy_labs/_helper_functions.py +14 -3
- sempy_labs/_list_functions.py +1 -1
- sempy_labs/_model_auto_build.py +4 -2
- sempy_labs/_model_bpa.py +2 -15
- sempy_labs/_model_bpa_bulk.py +14 -6
- sempy_labs/_model_dependencies.py +3 -1
- sempy_labs/_refresh_semantic_model.py +6 -0
- sempy_labs/admin/__init__.py +19 -9
- sempy_labs/admin/_basic_functions.py +475 -548
- sempy_labs/admin/_external_data_share.py +97 -0
- sempy_labs/admin/_git.py +69 -0
- sempy_labs/admin/_items.py +264 -0
- sempy_labs/admin/_scanner.py +104 -0
- sempy_labs/directlake/_dl_helper.py +6 -2
- sempy_labs/directlake/_get_shared_expression.py +5 -35
- sempy_labs/directlake/_update_directlake_model_lakehouse_connection.py +3 -2
- sempy_labs/migration/_create_pqt_file.py +4 -2
- sempy_labs/migration/_migrate_tables_columns_to_semantic_model.py +4 -2
- sempy_labs/report/_generate_report.py +10 -4
- sempy_labs/report/_report_bpa.py +1 -0
- sempy_labs/report/_report_helper.py +58 -0
- sempy_labs/report/_report_list_functions.py +2 -0
- sempy_labs/report/_reportwrapper.py +358 -175
- sempy_labs/tom/_model.py +2 -1
- {semantic_link_labs-0.8.5.dist-info → semantic_link_labs-0.8.7.dist-info}/LICENSE +0 -0
- {semantic_link_labs-0.8.5.dist-info → semantic_link_labs-0.8.7.dist-info}/top_level.txt +0 -0
sempy_labs/_model_bpa_bulk.py
CHANGED
|
@@ -101,8 +101,11 @@ def run_model_bpa_bulk(
|
|
|
101
101
|
dfD = fabric.list_datasets(workspace=wksp, mode="rest")
|
|
102
102
|
|
|
103
103
|
# Skip models in workspace
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
if skip_models_in_workspace is not None and isinstance(
|
|
105
|
+
skip_models_in_workspace, dict
|
|
106
|
+
):
|
|
107
|
+
skip_models_wkspc = skip_models_in_workspace.get(wksp)
|
|
108
|
+
dfD = dfD[~dfD["Dataset Name"].isin(skip_models_wkspc)]
|
|
106
109
|
|
|
107
110
|
# Exclude default semantic models
|
|
108
111
|
if len(dfD) > 0:
|
|
@@ -145,7 +148,10 @@ def run_model_bpa_bulk(
|
|
|
145
148
|
|
|
146
149
|
bpa_df["RunId"] = bpa_df["RunId"].astype("int")
|
|
147
150
|
|
|
148
|
-
df
|
|
151
|
+
if df.empty:
|
|
152
|
+
df = bpa_df
|
|
153
|
+
if not bpa_df.empty:
|
|
154
|
+
df = pd.concat([df, bpa_df], ignore_index=True)
|
|
149
155
|
print(
|
|
150
156
|
f"{icons.green_dot} Collected Model BPA stats for the '{dataset_name}' semantic model within the '{wksp}' workspace."
|
|
151
157
|
)
|
|
@@ -160,7 +166,7 @@ def run_model_bpa_bulk(
|
|
|
160
166
|
f"{icons.yellow_dot} No BPA results to save for the '{wksp}' workspace."
|
|
161
167
|
)
|
|
162
168
|
else:
|
|
163
|
-
df["Severity"].replace(icons.severity_mapping)
|
|
169
|
+
df["Severity"].replace(icons.severity_mapping, inplace=True)
|
|
164
170
|
|
|
165
171
|
# Append save results individually for each workspace (so as not to create a giant dataframe)
|
|
166
172
|
print(
|
|
@@ -214,7 +220,7 @@ def create_model_bpa_semantic_model(
|
|
|
214
220
|
|
|
215
221
|
from sempy_labs._helper_functions import resolve_lakehouse_name
|
|
216
222
|
from sempy_labs.directlake import (
|
|
217
|
-
|
|
223
|
+
generate_shared_expression,
|
|
218
224
|
add_table_to_direct_lake_semantic_model,
|
|
219
225
|
)
|
|
220
226
|
from sempy_labs import create_blank_semantic_model, refresh_semantic_model
|
|
@@ -229,7 +235,9 @@ def create_model_bpa_semantic_model(
|
|
|
229
235
|
)
|
|
230
236
|
|
|
231
237
|
# Generate the shared expression based on the lakehouse and lakehouse workspace
|
|
232
|
-
expr =
|
|
238
|
+
expr = generate_shared_expression(
|
|
239
|
+
item_name=lakehouse, item_type="Lakehouse", workspace=lakehouse_workspace
|
|
240
|
+
)
|
|
233
241
|
|
|
234
242
|
# Create blank model
|
|
235
243
|
create_blank_semantic_model(
|
|
@@ -190,7 +190,9 @@ def get_model_calc_dependencies(
|
|
|
190
190
|
# Initialize dependency DataFrame with 'Done' status
|
|
191
191
|
df = dep.copy()
|
|
192
192
|
objs = {"Measure", "Calc Column", "Calculation Item", "Calc Table"}
|
|
193
|
-
df["Done"] =
|
|
193
|
+
df["Done"] = (
|
|
194
|
+
df["Referenced Object Type"].apply(lambda x: x not in objs).astype(bool)
|
|
195
|
+
)
|
|
194
196
|
# Expand dependencies iteratively
|
|
195
197
|
while not df["Done"].all():
|
|
196
198
|
incomplete_rows = df[df["Done"] == False]
|
|
@@ -27,6 +27,7 @@ def refresh_semantic_model(
|
|
|
27
27
|
max_parallelism: int = 10,
|
|
28
28
|
workspace: Optional[str] = None,
|
|
29
29
|
visualize: bool = False,
|
|
30
|
+
commit_mode: str = "transactional",
|
|
30
31
|
) -> pd.DataFrame | None:
|
|
31
32
|
"""
|
|
32
33
|
Refreshes a semantic model.
|
|
@@ -55,6 +56,8 @@ def refresh_semantic_model(
|
|
|
55
56
|
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
56
57
|
visualize : bool, default=False
|
|
57
58
|
If True, displays a Gantt chart showing the refresh statistics for each table/partition.
|
|
59
|
+
commit_mode : str, default="transactional"
|
|
60
|
+
Determines whether to commit objects in batches or only when complete. Modes are "transactional" and "partialBatch". Defaults to "transactional".
|
|
58
61
|
|
|
59
62
|
Returns
|
|
60
63
|
-------
|
|
@@ -104,6 +107,7 @@ def refresh_semantic_model(
|
|
|
104
107
|
max_parallelism,
|
|
105
108
|
objects,
|
|
106
109
|
visualize,
|
|
110
|
+
commit_mode,
|
|
107
111
|
):
|
|
108
112
|
# Ignore specific warnings
|
|
109
113
|
warnings.filterwarnings(
|
|
@@ -137,6 +141,7 @@ def refresh_semantic_model(
|
|
|
137
141
|
retry_count=retry_count,
|
|
138
142
|
apply_refresh_policy=apply_refresh_policy,
|
|
139
143
|
max_parallelism=max_parallelism,
|
|
144
|
+
commit_mode=commit_mode,
|
|
140
145
|
objects=objects if objects else None,
|
|
141
146
|
)
|
|
142
147
|
|
|
@@ -259,6 +264,7 @@ def refresh_semantic_model(
|
|
|
259
264
|
max_parallelism=max_parallelism,
|
|
260
265
|
objects=objects,
|
|
261
266
|
visualize=visualize,
|
|
267
|
+
commit_mode=commit_mode,
|
|
262
268
|
)
|
|
263
269
|
|
|
264
270
|
return final_output
|
sempy_labs/admin/__init__.py
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
from sempy_labs.admin._basic_functions import (
|
|
2
2
|
assign_workspaces_to_capacity,
|
|
3
|
-
list_capacities,
|
|
4
|
-
list_tenant_settings,
|
|
5
|
-
list_capacities_delegated_tenant_settings,
|
|
6
3
|
unassign_workspaces_from_capacity,
|
|
7
|
-
list_external_data_shares,
|
|
8
|
-
revoke_external_data_share,
|
|
9
4
|
list_workspaces,
|
|
5
|
+
list_workspace_access_details,
|
|
6
|
+
list_modified_workspaces,
|
|
10
7
|
list_datasets,
|
|
11
|
-
|
|
8
|
+
list_reports,
|
|
9
|
+
list_capacities,
|
|
10
|
+
list_tenant_settings,
|
|
11
|
+
list_capacities_delegated_tenant_settings,
|
|
12
12
|
list_access_entities,
|
|
13
|
-
list_workspace_access_details,
|
|
14
|
-
list_items,
|
|
15
13
|
list_activity_events,
|
|
16
|
-
list_modified_workspaces,
|
|
17
14
|
)
|
|
18
15
|
from sempy_labs.admin._domains import (
|
|
19
16
|
list_domains,
|
|
@@ -27,6 +24,17 @@ from sempy_labs.admin._domains import (
|
|
|
27
24
|
unassign_domain_workspaces,
|
|
28
25
|
unassign_all_domain_workspaces,
|
|
29
26
|
)
|
|
27
|
+
from sempy_labs.admin._items import (
|
|
28
|
+
list_item_access_details,
|
|
29
|
+
list_items,
|
|
30
|
+
)
|
|
31
|
+
from sempy_labs.admin._external_data_share import (
|
|
32
|
+
list_external_data_shares,
|
|
33
|
+
revoke_external_data_share,
|
|
34
|
+
)
|
|
35
|
+
from sempy_labs.admin._git import (
|
|
36
|
+
list_git_connections,
|
|
37
|
+
)
|
|
30
38
|
|
|
31
39
|
__all__ = [
|
|
32
40
|
"list_items",
|
|
@@ -54,4 +62,6 @@ __all__ = [
|
|
|
54
62
|
"revoke_external_data_share",
|
|
55
63
|
"list_activity_events",
|
|
56
64
|
"list_modified_workspaces",
|
|
65
|
+
"list_git_connections",
|
|
66
|
+
"list_reports",
|
|
57
67
|
]
|