semantic-link-labs 0.8.6__py3-none-any.whl → 0.8.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.
Potentially problematic release.
This version of semantic-link-labs might be problematic. Click here for more details.
- {semantic_link_labs-0.8.6.dist-info → semantic_link_labs-0.8.8.dist-info}/METADATA +15 -6
- {semantic_link_labs-0.8.6.dist-info → semantic_link_labs-0.8.8.dist-info}/RECORD +35 -29
- {semantic_link_labs-0.8.6.dist-info → semantic_link_labs-0.8.8.dist-info}/WHEEL +1 -1
- sempy_labs/__init__.py +37 -6
- sempy_labs/_authentication.py +108 -0
- sempy_labs/_connections.py +356 -177
- 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 +4 -2
- sempy_labs/_model_dependencies.py +2 -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/_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 +1 -0
- {semantic_link_labs-0.8.6.dist-info → semantic_link_labs-0.8.8.dist-info}/LICENSE +0 -0
- {semantic_link_labs-0.8.6.dist-info → semantic_link_labs-0.8.8.dist-info}/top_level.txt +0 -0
sempy_labs/report/_report_bpa.py
CHANGED
|
@@ -29,6 +29,7 @@ def run_report_bpa(
|
|
|
29
29
|
):
|
|
30
30
|
"""
|
|
31
31
|
Displays an HTML visualization of the results of the Best Practice Analyzer scan for a report.
|
|
32
|
+
Note: As with all functions which rely on the ReportWrapper, this function requires the report to be in the 'PBIR' format.
|
|
32
33
|
|
|
33
34
|
Parameters
|
|
34
35
|
----------
|
|
@@ -252,3 +252,61 @@ def find_entity_property_pairs(data, result=None, keys_path=None):
|
|
|
252
252
|
find_entity_property_pairs(item, result, keys_path)
|
|
253
253
|
|
|
254
254
|
return result
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def _get_agg_type_mapping() -> dict:
|
|
258
|
+
"""
|
|
259
|
+
This function extracts a mapping dictionary like this:
|
|
260
|
+
{
|
|
261
|
+
"0": "Sum",
|
|
262
|
+
"1": "Average",
|
|
263
|
+
"2": "Distinct count",
|
|
264
|
+
}
|
|
265
|
+
"""
|
|
266
|
+
|
|
267
|
+
schema_url = "https://developer.microsoft.com/json-schemas/fabric/item/report/definition/semanticQuery/1.2.0/schema.json"
|
|
268
|
+
response = requests.get(schema_url)
|
|
269
|
+
schema = response.json()
|
|
270
|
+
aggtypes_schema = schema.get("definitions", {}).get("QueryAggregateFunction", {})
|
|
271
|
+
|
|
272
|
+
agg_type_map = {}
|
|
273
|
+
agg_type_map = {
|
|
274
|
+
a.get("const"): a.get("description")
|
|
275
|
+
for a in aggtypes_schema.get("anyOf", [])
|
|
276
|
+
if "const" in a and "description" in a
|
|
277
|
+
}
|
|
278
|
+
agg_type_map["-1"] = "Unknown"
|
|
279
|
+
|
|
280
|
+
return agg_type_map
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
def _get_expression(expr_json, agg_type_map):
|
|
284
|
+
|
|
285
|
+
expr_type = list(expr_json.keys())[0]
|
|
286
|
+
if expr_type == "Literal":
|
|
287
|
+
expr = expr_json.get("Literal", {}).get("Value")[1:-1]
|
|
288
|
+
elif expr_type == "Aggregation":
|
|
289
|
+
entity = (
|
|
290
|
+
expr_json.get("Aggregation", {})
|
|
291
|
+
.get("Expression", {})
|
|
292
|
+
.get("Column", {})
|
|
293
|
+
.get("Expression", {})
|
|
294
|
+
.get("SourceRef", {})
|
|
295
|
+
.get("Entity", "Unknown")
|
|
296
|
+
)
|
|
297
|
+
column = (
|
|
298
|
+
expr_json.get("Aggregation", {})
|
|
299
|
+
.get("Expression", {})
|
|
300
|
+
.get("Column", {})
|
|
301
|
+
.get("Property", "Unknown")
|
|
302
|
+
)
|
|
303
|
+
function_id = expr_json.get("Aggregation", {}).get("Function", "-1")
|
|
304
|
+
function = agg_type_map.get(function_id)
|
|
305
|
+
expr = f"{function}('{entity}'[{column}])"
|
|
306
|
+
elif expr_type == "Measure":
|
|
307
|
+
measure = expr_json.get("Measure", {}).get("Property", "Unknown")
|
|
308
|
+
expr = f"[{measure}]"
|
|
309
|
+
else:
|
|
310
|
+
expr = "Unknown"
|
|
311
|
+
|
|
312
|
+
return expr
|
|
@@ -13,6 +13,7 @@ def list_unused_objects_in_reports(
|
|
|
13
13
|
) -> pd.DataFrame:
|
|
14
14
|
"""
|
|
15
15
|
Shows a list of all columns in the semantic model which are not used in any related Power BI reports (including dependencies).
|
|
16
|
+
Note: As with all functions which rely on the ReportWrapper, this function requires the report to be in the 'PBIR' format.
|
|
16
17
|
|
|
17
18
|
Parameters
|
|
18
19
|
----------
|
|
@@ -55,6 +56,7 @@ def _list_all_report_semantic_model_objects(
|
|
|
55
56
|
) -> pd.DataFrame:
|
|
56
57
|
"""
|
|
57
58
|
Shows a unique list of all semantic model objects (columns, measures, hierarchies) which are used in all reports which leverage the semantic model.
|
|
59
|
+
Note: As with all functions which rely on the ReportWrapper, this function requires the report to be in the 'PBIR' format.
|
|
58
60
|
|
|
59
61
|
Parameters
|
|
60
62
|
----------
|