semantic-link-labs 0.8.10__py3-none-any.whl → 0.8.11__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.10.dist-info → semantic_link_labs-0.8.11.dist-info}/METADATA +3 -2
- {semantic_link_labs-0.8.10.dist-info → semantic_link_labs-0.8.11.dist-info}/RECORD +73 -72
- sempy_labs/__init__.py +6 -2
- sempy_labs/_clear_cache.py +39 -37
- sempy_labs/_connections.py +13 -13
- sempy_labs/_data_pipelines.py +20 -20
- sempy_labs/_dataflows.py +27 -28
- sempy_labs/_dax.py +41 -47
- sempy_labs/_environments.py +26 -23
- sempy_labs/_eventhouses.py +16 -15
- sempy_labs/_eventstreams.py +16 -15
- sempy_labs/_external_data_shares.py +18 -20
- sempy_labs/_gateways.py +14 -14
- sempy_labs/_generate_semantic_model.py +99 -62
- sempy_labs/_git.py +105 -43
- sempy_labs/_helper_functions.py +148 -131
- sempy_labs/_job_scheduler.py +92 -0
- sempy_labs/_kql_databases.py +16 -15
- sempy_labs/_kql_querysets.py +16 -15
- sempy_labs/_list_functions.py +114 -99
- sempy_labs/_managed_private_endpoints.py +19 -17
- sempy_labs/_mirrored_databases.py +51 -48
- sempy_labs/_mirrored_warehouses.py +5 -4
- sempy_labs/_ml_experiments.py +16 -15
- sempy_labs/_ml_models.py +15 -14
- sempy_labs/_model_bpa.py +3 -3
- sempy_labs/_model_dependencies.py +55 -29
- sempy_labs/_notebooks.py +27 -25
- sempy_labs/_one_lake_integration.py +23 -26
- sempy_labs/_query_scale_out.py +67 -64
- sempy_labs/_refresh_semantic_model.py +25 -26
- sempy_labs/_spark.py +33 -32
- sempy_labs/_sql.py +12 -9
- sempy_labs/_translations.py +10 -7
- sempy_labs/_vertipaq.py +34 -31
- sempy_labs/_warehouses.py +22 -21
- sempy_labs/_workspace_identity.py +11 -10
- sempy_labs/_workspaces.py +40 -33
- sempy_labs/admin/_basic_functions.py +10 -12
- sempy_labs/admin/_external_data_share.py +3 -3
- sempy_labs/admin/_items.py +4 -4
- sempy_labs/admin/_scanner.py +3 -1
- sempy_labs/directlake/_directlake_schema_compare.py +18 -14
- sempy_labs/directlake/_directlake_schema_sync.py +18 -12
- sempy_labs/directlake/_dl_helper.py +25 -26
- sempy_labs/directlake/_generate_shared_expression.py +10 -9
- sempy_labs/directlake/_get_directlake_lakehouse.py +16 -13
- sempy_labs/directlake/_get_shared_expression.py +4 -3
- sempy_labs/directlake/_guardrails.py +12 -6
- sempy_labs/directlake/_list_directlake_model_calc_tables.py +15 -9
- sempy_labs/directlake/_show_unsupported_directlake_objects.py +16 -10
- sempy_labs/directlake/_update_directlake_model_lakehouse_connection.py +35 -31
- sempy_labs/directlake/_update_directlake_partition_entity.py +34 -31
- sempy_labs/directlake/_warm_cache.py +87 -65
- sempy_labs/lakehouse/_get_lakehouse_columns.py +10 -8
- sempy_labs/lakehouse/_get_lakehouse_tables.py +10 -9
- sempy_labs/lakehouse/_lakehouse.py +17 -13
- sempy_labs/lakehouse/_shortcuts.py +42 -23
- sempy_labs/migration/_create_pqt_file.py +16 -11
- sempy_labs/migration/_refresh_calc_tables.py +16 -10
- sempy_labs/report/_download_report.py +9 -8
- sempy_labs/report/_generate_report.py +40 -44
- sempy_labs/report/_paginated.py +9 -9
- sempy_labs/report/_report_bpa.py +13 -9
- sempy_labs/report/_report_functions.py +80 -91
- sempy_labs/report/_report_helper.py +8 -4
- sempy_labs/report/_report_list_functions.py +24 -13
- sempy_labs/report/_report_rebind.py +17 -16
- sempy_labs/report/_reportwrapper.py +41 -33
- sempy_labs/tom/_model.py +43 -6
- {semantic_link_labs-0.8.10.dist-info → semantic_link_labs-0.8.11.dist-info}/LICENSE +0 -0
- {semantic_link_labs-0.8.10.dist-info → semantic_link_labs-0.8.11.dist-info}/WHEEL +0 -0
- {semantic_link_labs-0.8.10.dist-info → semantic_link_labs-0.8.11.dist-info}/top_level.txt +0 -0
sempy_labs/_list_functions.py
CHANGED
|
@@ -3,7 +3,6 @@ from sempy_labs._helper_functions import (
|
|
|
3
3
|
resolve_workspace_name_and_id,
|
|
4
4
|
create_relationship_name,
|
|
5
5
|
resolve_lakehouse_id,
|
|
6
|
-
resolve_dataset_id,
|
|
7
6
|
pagination,
|
|
8
7
|
resolve_item_type,
|
|
9
8
|
format_dax_object_name,
|
|
@@ -17,17 +16,17 @@ from uuid import UUID
|
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
def get_object_level_security(
|
|
20
|
-
dataset: str | UUID, workspace: Optional[str] = None
|
|
19
|
+
dataset: str | UUID, workspace: Optional[str | UUID] = None
|
|
21
20
|
) -> pd.DataFrame:
|
|
22
21
|
"""
|
|
23
22
|
Shows the object level security for the semantic model.
|
|
24
23
|
|
|
25
24
|
Parameters
|
|
26
25
|
----------
|
|
27
|
-
dataset : str | UUID
|
|
26
|
+
dataset : str | uuid.UUID
|
|
28
27
|
Name or ID of the semantic model.
|
|
29
|
-
workspace : str, default=None
|
|
30
|
-
The Fabric workspace name.
|
|
28
|
+
workspace : str | uuid.UUID, default=None
|
|
29
|
+
The Fabric workspace name or ID.
|
|
31
30
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
32
31
|
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
33
32
|
|
|
@@ -85,17 +84,17 @@ def get_object_level_security(
|
|
|
85
84
|
|
|
86
85
|
|
|
87
86
|
def list_tables(
|
|
88
|
-
dataset: str | UUID, workspace: Optional[str] = None, extended: bool = False
|
|
87
|
+
dataset: str | UUID, workspace: Optional[str | UUID] = None, extended: bool = False
|
|
89
88
|
) -> pd.DataFrame:
|
|
90
89
|
"""
|
|
91
90
|
Shows a semantic model's tables and their properties.
|
|
92
91
|
|
|
93
92
|
Parameters
|
|
94
93
|
----------
|
|
95
|
-
dataset : str | UUID
|
|
94
|
+
dataset : str | uuid.UUID
|
|
96
95
|
Name or ID of the semantic model.
|
|
97
|
-
workspace : str, default=None
|
|
98
|
-
The Fabric workspace name.
|
|
96
|
+
workspace : str | uuid.UUID, default=None
|
|
97
|
+
The Fabric workspace name or ID.
|
|
99
98
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
100
99
|
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
101
100
|
extended : bool, default=False
|
|
@@ -258,16 +257,18 @@ def list_tables(
|
|
|
258
257
|
return df
|
|
259
258
|
|
|
260
259
|
|
|
261
|
-
def list_annotations(
|
|
260
|
+
def list_annotations(
|
|
261
|
+
dataset: str | UUID, workspace: Optional[str | UUID] = None
|
|
262
|
+
) -> pd.DataFrame:
|
|
262
263
|
"""
|
|
263
264
|
Shows a semantic model's annotations and their properties.
|
|
264
265
|
|
|
265
266
|
Parameters
|
|
266
267
|
----------
|
|
267
|
-
dataset : str
|
|
268
|
-
Name of the semantic model.
|
|
269
|
-
workspace : str, default=None
|
|
270
|
-
The Fabric workspace name.
|
|
268
|
+
dataset : str | uuid.UUID
|
|
269
|
+
Name or ID of the semantic model.
|
|
270
|
+
workspace : str | uuid.UUID, default=None
|
|
271
|
+
The Fabric workspace name or ID.
|
|
271
272
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
272
273
|
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
273
274
|
|
|
@@ -279,7 +280,8 @@ def list_annotations(dataset: str, workspace: Optional[str] = None) -> pd.DataFr
|
|
|
279
280
|
|
|
280
281
|
from sempy_labs.tom import connect_semantic_model
|
|
281
282
|
|
|
282
|
-
|
|
283
|
+
(workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
|
|
284
|
+
(dataset_name, dataset_id) = resolve_dataset_name_and_id(dataset, workspace_id)
|
|
283
285
|
|
|
284
286
|
df = pd.DataFrame(
|
|
285
287
|
columns=[
|
|
@@ -292,7 +294,7 @@ def list_annotations(dataset: str, workspace: Optional[str] = None) -> pd.DataFr
|
|
|
292
294
|
)
|
|
293
295
|
|
|
294
296
|
with connect_semantic_model(
|
|
295
|
-
dataset=
|
|
297
|
+
dataset=dataset_id, readonly=True, workspace=workspace_id
|
|
296
298
|
) as tom:
|
|
297
299
|
|
|
298
300
|
mName = tom.model.Name
|
|
@@ -489,8 +491,8 @@ def list_annotations(dataset: str, workspace: Optional[str] = None) -> pd.DataFr
|
|
|
489
491
|
|
|
490
492
|
|
|
491
493
|
def list_columns(
|
|
492
|
-
dataset: str,
|
|
493
|
-
workspace: Optional[str] = None,
|
|
494
|
+
dataset: str | UUID,
|
|
495
|
+
workspace: Optional[str | UUID] = None,
|
|
494
496
|
lakehouse: Optional[str] = None,
|
|
495
497
|
lakehouse_workspace: Optional[str] = None,
|
|
496
498
|
) -> pd.DataFrame:
|
|
@@ -499,10 +501,10 @@ def list_columns(
|
|
|
499
501
|
|
|
500
502
|
Parameters
|
|
501
503
|
----------
|
|
502
|
-
dataset : str
|
|
503
|
-
Name of the semantic model.
|
|
504
|
-
workspace : str, default=None
|
|
505
|
-
The Fabric workspace name.
|
|
504
|
+
dataset : str | uuid.UUID
|
|
505
|
+
Name or ID of the semantic model.
|
|
506
|
+
workspace : str | uuid.UUID, default=None
|
|
507
|
+
The Fabric workspace name or ID.
|
|
506
508
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
507
509
|
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
508
510
|
lakehouse : str, default=None
|
|
@@ -523,20 +525,21 @@ def list_columns(
|
|
|
523
525
|
)
|
|
524
526
|
from pyspark.sql import SparkSession
|
|
525
527
|
|
|
526
|
-
|
|
528
|
+
(workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
|
|
529
|
+
(dataset_name, dataset_id) = resolve_dataset_name_and_id(dataset, workspace_id)
|
|
527
530
|
|
|
528
|
-
dfP = fabric.list_partitions(dataset=
|
|
531
|
+
dfP = fabric.list_partitions(dataset=dataset_id, workspace=workspace_id)
|
|
529
532
|
|
|
530
533
|
isDirectLake = any(r["Mode"] == "DirectLake" for i, r in dfP.iterrows())
|
|
531
534
|
|
|
532
|
-
dfC = fabric.list_columns(dataset=
|
|
535
|
+
dfC = fabric.list_columns(dataset=dataset_id, workspace=workspace_id)
|
|
533
536
|
|
|
534
537
|
if isDirectLake:
|
|
535
538
|
dfC["Column Cardinality"] = None
|
|
536
539
|
sql_statements = []
|
|
537
540
|
(lakeID, lakeName) = get_direct_lake_lakehouse(
|
|
538
|
-
dataset=
|
|
539
|
-
workspace=
|
|
541
|
+
dataset=dataset_id,
|
|
542
|
+
workspace=workspace_id,
|
|
540
543
|
lakehouse=lakehouse,
|
|
541
544
|
lakehouse_workspace=lakehouse_workspace,
|
|
542
545
|
)
|
|
@@ -590,14 +593,14 @@ def list_columns(
|
|
|
590
593
|
return dfC
|
|
591
594
|
|
|
592
595
|
|
|
593
|
-
def list_dashboards(workspace: Optional[str] = None) -> pd.DataFrame:
|
|
596
|
+
def list_dashboards(workspace: Optional[str | UUID] = None) -> pd.DataFrame:
|
|
594
597
|
"""
|
|
595
598
|
Shows a list of the dashboards within a workspace.
|
|
596
599
|
|
|
597
600
|
Parameters
|
|
598
601
|
----------
|
|
599
|
-
workspace : str, default=None
|
|
600
|
-
The Fabric workspace name.
|
|
602
|
+
workspace : str | uuid.UUID, default=None
|
|
603
|
+
The Fabric workspace name or ID.
|
|
601
604
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
602
605
|
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
603
606
|
|
|
@@ -620,7 +623,7 @@ def list_dashboards(workspace: Optional[str] = None) -> pd.DataFrame:
|
|
|
620
623
|
]
|
|
621
624
|
)
|
|
622
625
|
|
|
623
|
-
(
|
|
626
|
+
(workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
|
|
624
627
|
|
|
625
628
|
client = fabric.PowerBIRestClient()
|
|
626
629
|
response = client.get(f"/v1.0/myorg/groups/{workspace_id}/dashboards")
|
|
@@ -645,14 +648,14 @@ def list_dashboards(workspace: Optional[str] = None) -> pd.DataFrame:
|
|
|
645
648
|
return df
|
|
646
649
|
|
|
647
650
|
|
|
648
|
-
def list_lakehouses(workspace: Optional[str] = None) -> pd.DataFrame:
|
|
651
|
+
def list_lakehouses(workspace: Optional[str | UUID] = None) -> pd.DataFrame:
|
|
649
652
|
"""
|
|
650
653
|
Shows the lakehouses within a workspace.
|
|
651
654
|
|
|
652
655
|
Parameters
|
|
653
656
|
----------
|
|
654
|
-
workspace : str, default=None
|
|
655
|
-
The Fabric workspace name.
|
|
657
|
+
workspace : str | uuid.UUID, default=None
|
|
658
|
+
The Fabric workspace name or ID.
|
|
656
659
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
657
660
|
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
658
661
|
|
|
@@ -675,7 +678,7 @@ def list_lakehouses(workspace: Optional[str] = None) -> pd.DataFrame:
|
|
|
675
678
|
]
|
|
676
679
|
)
|
|
677
680
|
|
|
678
|
-
(
|
|
681
|
+
(workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
|
|
679
682
|
|
|
680
683
|
client = fabric.FabricRestClient()
|
|
681
684
|
response = client.get(f"/v1/workspaces/{workspace_id}/lakehouses")
|
|
@@ -705,14 +708,14 @@ def list_lakehouses(workspace: Optional[str] = None) -> pd.DataFrame:
|
|
|
705
708
|
return df
|
|
706
709
|
|
|
707
710
|
|
|
708
|
-
def list_sql_endpoints(workspace: Optional[str] = None) -> pd.DataFrame:
|
|
711
|
+
def list_sql_endpoints(workspace: Optional[str | UUID] = None) -> pd.DataFrame:
|
|
709
712
|
"""
|
|
710
713
|
Shows the SQL endpoints within a workspace.
|
|
711
714
|
|
|
712
715
|
Parameters
|
|
713
716
|
----------
|
|
714
|
-
workspace : str, default=None
|
|
715
|
-
The Fabric workspace name.
|
|
717
|
+
workspace : str | uuid.UUID, default=None
|
|
718
|
+
The Fabric workspace name or ID.
|
|
716
719
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
717
720
|
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
718
721
|
|
|
@@ -724,7 +727,7 @@ def list_sql_endpoints(workspace: Optional[str] = None) -> pd.DataFrame:
|
|
|
724
727
|
|
|
725
728
|
df = pd.DataFrame(columns=["SQL Endpoint Id", "SQL Endpoint Name", "Description"])
|
|
726
729
|
|
|
727
|
-
(
|
|
730
|
+
(workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
|
|
728
731
|
|
|
729
732
|
client = fabric.FabricRestClient()
|
|
730
733
|
response = client.get(f"/v1/workspaces/{workspace_id}/sqlEndpoints")
|
|
@@ -746,14 +749,14 @@ def list_sql_endpoints(workspace: Optional[str] = None) -> pd.DataFrame:
|
|
|
746
749
|
return df
|
|
747
750
|
|
|
748
751
|
|
|
749
|
-
def list_datamarts(workspace: Optional[str] = None) -> pd.DataFrame:
|
|
752
|
+
def list_datamarts(workspace: Optional[str | UUID] = None) -> pd.DataFrame:
|
|
750
753
|
"""
|
|
751
754
|
Shows the datamarts within a workspace.
|
|
752
755
|
|
|
753
756
|
Parameters
|
|
754
757
|
----------
|
|
755
|
-
workspace : str, default=None
|
|
756
|
-
The Fabric workspace name.
|
|
758
|
+
workspace : str | uuid.UUID, default=None
|
|
759
|
+
The Fabric workspace name or ID.
|
|
757
760
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
758
761
|
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
759
762
|
|
|
@@ -765,7 +768,7 @@ def list_datamarts(workspace: Optional[str] = None) -> pd.DataFrame:
|
|
|
765
768
|
|
|
766
769
|
df = pd.DataFrame(columns=["Datamart Name", "Datamart ID", "Description"])
|
|
767
770
|
|
|
768
|
-
(
|
|
771
|
+
(workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
|
|
769
772
|
|
|
770
773
|
client = fabric.FabricRestClient()
|
|
771
774
|
response = client.get(f"/v1/workspaces/{workspace_id}/datamarts")
|
|
@@ -791,7 +794,7 @@ def update_item(
|
|
|
791
794
|
current_name: str,
|
|
792
795
|
new_name: str,
|
|
793
796
|
description: Optional[str] = None,
|
|
794
|
-
workspace: Optional[str] = None,
|
|
797
|
+
workspace: Optional[str | UUID] = None,
|
|
795
798
|
):
|
|
796
799
|
"""
|
|
797
800
|
Updates the name/description of a Fabric item.
|
|
@@ -806,13 +809,13 @@ def update_item(
|
|
|
806
809
|
The new name of the item.
|
|
807
810
|
description : str, default=None
|
|
808
811
|
A description of the item.
|
|
809
|
-
workspace : str, default=None
|
|
810
|
-
The Fabric workspace name.
|
|
812
|
+
workspace : str | uuid.UUID, default=None
|
|
813
|
+
The Fabric workspace name or ID.
|
|
811
814
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
812
815
|
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
813
816
|
"""
|
|
814
817
|
|
|
815
|
-
(
|
|
818
|
+
(workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
|
|
816
819
|
item_type = item_type.replace(" ", "").capitalize()
|
|
817
820
|
|
|
818
821
|
if item_type not in icons.itemTypes.keys():
|
|
@@ -822,12 +825,12 @@ def update_item(
|
|
|
822
825
|
|
|
823
826
|
itemType = icons.itemTypes[item_type]
|
|
824
827
|
|
|
825
|
-
dfI = fabric.list_items(workspace=
|
|
828
|
+
dfI = fabric.list_items(workspace=workspace_id, type=item_type)
|
|
826
829
|
dfI_filt = dfI[(dfI["Display Name"] == current_name)]
|
|
827
830
|
|
|
828
831
|
if len(dfI_filt) == 0:
|
|
829
832
|
raise ValueError(
|
|
830
|
-
f"{icons.red_dot} The '{current_name}' {item_type} does not exist within the '{
|
|
833
|
+
f"{icons.red_dot} The '{current_name}' {item_type} does not exist within the '{workspace_name}' workspace."
|
|
831
834
|
)
|
|
832
835
|
|
|
833
836
|
itemId = dfI_filt["Id"].iloc[0]
|
|
@@ -845,26 +848,26 @@ def update_item(
|
|
|
845
848
|
raise FabricHTTPException(response)
|
|
846
849
|
if description is None:
|
|
847
850
|
print(
|
|
848
|
-
f"{icons.green_dot} The '{current_name}' {item_type} within the '{
|
|
851
|
+
f"{icons.green_dot} The '{current_name}' {item_type} within the '{workspace_name}' workspace has been updated to be named '{new_name}'"
|
|
849
852
|
)
|
|
850
853
|
else:
|
|
851
854
|
print(
|
|
852
|
-
f"{icons.green_dot} The '{current_name}' {item_type} within the '{
|
|
855
|
+
f"{icons.green_dot} The '{current_name}' {item_type} within the '{workspace_name}' workspace has been updated to be named '{new_name}' and have a description of '{description}'"
|
|
853
856
|
)
|
|
854
857
|
|
|
855
858
|
|
|
856
859
|
def list_relationships(
|
|
857
|
-
dataset: str | UUID, workspace: Optional[str] = None, extended: bool = False
|
|
860
|
+
dataset: str | UUID, workspace: Optional[str | UUID] = None, extended: bool = False
|
|
858
861
|
) -> pd.DataFrame:
|
|
859
862
|
"""
|
|
860
863
|
Shows a semantic model's relationships and their properties.
|
|
861
864
|
|
|
862
865
|
Parameters
|
|
863
866
|
----------
|
|
864
|
-
dataset: str | UUID
|
|
867
|
+
dataset: str | uuid.UUID
|
|
865
868
|
Name or UUID of the semantic model.
|
|
866
|
-
workspace : str, default=None
|
|
867
|
-
The Fabric workspace name.
|
|
869
|
+
workspace : str | uuid.UUID, default=None
|
|
870
|
+
The Fabric workspace name or ID.
|
|
868
871
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
869
872
|
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
870
873
|
extended : bool, default=False
|
|
@@ -937,16 +940,18 @@ def list_relationships(
|
|
|
937
940
|
return dfR
|
|
938
941
|
|
|
939
942
|
|
|
940
|
-
def list_kpis(
|
|
943
|
+
def list_kpis(
|
|
944
|
+
dataset: str | UUID, workspace: Optional[str | UUID] = None
|
|
945
|
+
) -> pd.DataFrame:
|
|
941
946
|
"""
|
|
942
947
|
Shows a semantic model's KPIs and their properties.
|
|
943
948
|
|
|
944
949
|
Parameters
|
|
945
950
|
----------
|
|
946
|
-
dataset: str
|
|
947
|
-
Name of the semantic model.
|
|
948
|
-
workspace : str, default=None
|
|
949
|
-
The Fabric workspace name.
|
|
951
|
+
dataset: str | uuid.UUID
|
|
952
|
+
Name or ID of the semantic model.
|
|
953
|
+
workspace : str | uuid.UUID, default=None
|
|
954
|
+
The Fabric workspace name or ID.
|
|
950
955
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
951
956
|
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
952
957
|
|
|
@@ -958,8 +963,11 @@ def list_kpis(dataset: str, workspace: Optional[str] = None) -> pd.DataFrame:
|
|
|
958
963
|
|
|
959
964
|
from sempy_labs.tom import connect_semantic_model
|
|
960
965
|
|
|
966
|
+
(workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
|
|
967
|
+
(dataset_name, dataset_id) = resolve_dataset_name_and_id(dataset, workspace_id)
|
|
968
|
+
|
|
961
969
|
with connect_semantic_model(
|
|
962
|
-
dataset=
|
|
970
|
+
dataset=dataset_id, workspace=workspace_id, readonly=True
|
|
963
971
|
) as tom:
|
|
964
972
|
|
|
965
973
|
df = pd.DataFrame(
|
|
@@ -1002,17 +1010,17 @@ def list_kpis(dataset: str, workspace: Optional[str] = None) -> pd.DataFrame:
|
|
|
1002
1010
|
|
|
1003
1011
|
|
|
1004
1012
|
def list_semantic_model_objects(
|
|
1005
|
-
dataset: str, workspace: Optional[str] = None
|
|
1013
|
+
dataset: str | UUID, workspace: Optional[str | UUID] = None
|
|
1006
1014
|
) -> pd.DataFrame:
|
|
1007
1015
|
"""
|
|
1008
1016
|
Shows a list of semantic model objects.
|
|
1009
1017
|
|
|
1010
1018
|
Parameters
|
|
1011
1019
|
----------
|
|
1012
|
-
dataset : str
|
|
1013
|
-
Name of the semantic model.
|
|
1014
|
-
workspace : str, default=None
|
|
1015
|
-
The Fabric workspace name.
|
|
1020
|
+
dataset : str | uuid.UUID
|
|
1021
|
+
Name or ID of the semantic model.
|
|
1022
|
+
workspace : str | uuid.UUID, default=None
|
|
1023
|
+
The Fabric workspace name or ID.
|
|
1016
1024
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
1017
1025
|
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
1018
1026
|
|
|
@@ -1166,7 +1174,7 @@ def list_semantic_model_objects(
|
|
|
1166
1174
|
|
|
1167
1175
|
|
|
1168
1176
|
def list_shortcuts(
|
|
1169
|
-
lakehouse: Optional[str] = None, workspace: Optional[str] = None
|
|
1177
|
+
lakehouse: Optional[str] = None, workspace: Optional[str | UUID] = None
|
|
1170
1178
|
) -> pd.DataFrame:
|
|
1171
1179
|
"""
|
|
1172
1180
|
Shows all shortcuts which exist in a Fabric lakehouse and their properties.
|
|
@@ -1176,8 +1184,8 @@ def list_shortcuts(
|
|
|
1176
1184
|
lakehouse : str, default=None
|
|
1177
1185
|
The Fabric lakehouse name.
|
|
1178
1186
|
Defaults to None which resolves to the lakehouse attached to the notebook.
|
|
1179
|
-
workspace : str, default=None
|
|
1180
|
-
The name of the Fabric workspace in which lakehouse resides.
|
|
1187
|
+
workspace : str | uuid.UUID, default=None
|
|
1188
|
+
The name or ID of the Fabric workspace in which lakehouse resides.
|
|
1181
1189
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
1182
1190
|
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
1183
1191
|
|
|
@@ -1187,12 +1195,12 @@ def list_shortcuts(
|
|
|
1187
1195
|
A pandas dataframe showing all the shortcuts which exist in the specified lakehouse.
|
|
1188
1196
|
"""
|
|
1189
1197
|
|
|
1190
|
-
(
|
|
1198
|
+
(workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
|
|
1191
1199
|
|
|
1192
1200
|
if lakehouse is None:
|
|
1193
1201
|
lakehouse_id = fabric.get_lakehouse_id()
|
|
1194
1202
|
else:
|
|
1195
|
-
lakehouse_id = resolve_lakehouse_id(lakehouse,
|
|
1203
|
+
lakehouse_id = resolve_lakehouse_id(lakehouse, workspace_id)
|
|
1196
1204
|
|
|
1197
1205
|
client = fabric.FabricRestClient()
|
|
1198
1206
|
|
|
@@ -1309,17 +1317,17 @@ def list_capacities() -> pd.DataFrame:
|
|
|
1309
1317
|
|
|
1310
1318
|
|
|
1311
1319
|
def list_reports_using_semantic_model(
|
|
1312
|
-
dataset: str, workspace: Optional[str] = None
|
|
1320
|
+
dataset: str | UUID, workspace: Optional[str | UUID] = None
|
|
1313
1321
|
) -> pd.DataFrame:
|
|
1314
1322
|
"""
|
|
1315
1323
|
Shows a list of all the reports (in all workspaces) which use a given semantic model.
|
|
1316
1324
|
|
|
1317
1325
|
Parameters
|
|
1318
1326
|
----------
|
|
1319
|
-
dataset : str
|
|
1320
|
-
Name of the semantic model.
|
|
1321
|
-
workspace : str, default=None
|
|
1322
|
-
The Fabric workspace name.
|
|
1327
|
+
dataset : str | uuid.UUID
|
|
1328
|
+
Name or ID of the semantic model.
|
|
1329
|
+
workspace : str | uuid.UUID, default=None
|
|
1330
|
+
The Fabric workspace name or ID.
|
|
1323
1331
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
1324
1332
|
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
1325
1333
|
|
|
@@ -1338,8 +1346,9 @@ def list_reports_using_semantic_model(
|
|
|
1338
1346
|
]
|
|
1339
1347
|
)
|
|
1340
1348
|
|
|
1341
|
-
|
|
1342
|
-
dataset_id =
|
|
1349
|
+
(workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
|
|
1350
|
+
(dataset_name, dataset_id) = resolve_dataset_name_and_id(dataset, workspace_id)
|
|
1351
|
+
|
|
1343
1352
|
client = fabric.PowerBIRestClient()
|
|
1344
1353
|
response = client.get(
|
|
1345
1354
|
f"metadata/relations/downstream/dataset/{dataset_id}?apiVersion=3"
|
|
@@ -1366,7 +1375,7 @@ def list_reports_using_semantic_model(
|
|
|
1366
1375
|
|
|
1367
1376
|
|
|
1368
1377
|
def list_report_semantic_model_objects(
|
|
1369
|
-
dataset: str, workspace: Optional[str] = None, extended: bool = False
|
|
1378
|
+
dataset: str | UUID, workspace: Optional[str | UUID] = None, extended: bool = False
|
|
1370
1379
|
) -> pd.DataFrame:
|
|
1371
1380
|
"""
|
|
1372
1381
|
Shows a list of semantic model objects (i.e. columns, measures, hierarchies) used in all reports which feed data from
|
|
@@ -1376,10 +1385,10 @@ def list_report_semantic_model_objects(
|
|
|
1376
1385
|
|
|
1377
1386
|
Parameters
|
|
1378
1387
|
----------
|
|
1379
|
-
dataset : str
|
|
1380
|
-
Name of the semantic model.
|
|
1381
|
-
workspace : str, default=None
|
|
1382
|
-
The Fabric workspace name.
|
|
1388
|
+
dataset : str | uuid.UUID
|
|
1389
|
+
Name or ID of the semantic model.
|
|
1390
|
+
workspace : str | uuid.UUID, default=None
|
|
1391
|
+
The Fabric workspace name or ID.
|
|
1383
1392
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
1384
1393
|
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
1385
1394
|
extended: bool, default=False
|
|
@@ -1408,8 +1417,11 @@ def list_report_semantic_model_objects(
|
|
|
1408
1417
|
]
|
|
1409
1418
|
)
|
|
1410
1419
|
|
|
1420
|
+
(workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
|
|
1421
|
+
(dataset_name, dataset_id) = resolve_dataset_name_and_id(dataset, workspace_id)
|
|
1422
|
+
|
|
1411
1423
|
# Collect all reports which use the semantic model
|
|
1412
|
-
dfR = list_reports_using_semantic_model(dataset=
|
|
1424
|
+
dfR = list_reports_using_semantic_model(dataset=dataset_id, workspace=workspace_id)
|
|
1413
1425
|
|
|
1414
1426
|
if len(dfR) == 0:
|
|
1415
1427
|
return dfRO
|
|
@@ -1433,7 +1445,7 @@ def list_report_semantic_model_objects(
|
|
|
1433
1445
|
# Collect all semantic model objects
|
|
1434
1446
|
if extended:
|
|
1435
1447
|
with connect_semantic_model(
|
|
1436
|
-
dataset=
|
|
1448
|
+
dataset=dataset_id, readonly=True, workspace=workspace_id
|
|
1437
1449
|
) as tom:
|
|
1438
1450
|
for index, row in dfRO.iterrows():
|
|
1439
1451
|
object_type = row["Object Type"]
|
|
@@ -1458,8 +1470,8 @@ def list_report_semantic_model_objects(
|
|
|
1458
1470
|
|
|
1459
1471
|
|
|
1460
1472
|
def list_semantic_model_object_report_usage(
|
|
1461
|
-
dataset: str,
|
|
1462
|
-
workspace: Optional[str] = None,
|
|
1473
|
+
dataset: str | UUID,
|
|
1474
|
+
workspace: Optional[str | UUID] = None,
|
|
1463
1475
|
include_dependencies: bool = False,
|
|
1464
1476
|
extended: bool = False,
|
|
1465
1477
|
) -> pd.DataFrame:
|
|
@@ -1470,10 +1482,10 @@ def list_semantic_model_object_report_usage(
|
|
|
1470
1482
|
|
|
1471
1483
|
Parameters
|
|
1472
1484
|
----------
|
|
1473
|
-
dataset : str
|
|
1474
|
-
Name of the semantic model.
|
|
1475
|
-
workspace : str, default=None
|
|
1476
|
-
The Fabric workspace name.
|
|
1485
|
+
dataset : str | uuid.UUID
|
|
1486
|
+
Name or ID of the semantic model.
|
|
1487
|
+
workspace : str | uuid.UUID, default=None
|
|
1488
|
+
The Fabric workspace name or ID.
|
|
1477
1489
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
1478
1490
|
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
1479
1491
|
include_dependencies : bool, default=False
|
|
@@ -1491,9 +1503,10 @@ def list_semantic_model_object_report_usage(
|
|
|
1491
1503
|
from sempy_labs._model_dependencies import get_model_calc_dependencies
|
|
1492
1504
|
from sempy_labs._helper_functions import format_dax_object_name
|
|
1493
1505
|
|
|
1494
|
-
|
|
1506
|
+
(workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
|
|
1507
|
+
(dataset_name, dataset_id) = resolve_dataset_name_and_id(dataset, workspace_id)
|
|
1495
1508
|
|
|
1496
|
-
dfR = list_report_semantic_model_objects(dataset=
|
|
1509
|
+
dfR = list_report_semantic_model_objects(dataset=dataset_id, workspace=workspace_id)
|
|
1497
1510
|
usage_column_name = "Report Usage Count"
|
|
1498
1511
|
|
|
1499
1512
|
if not include_dependencies:
|
|
@@ -1504,7 +1517,7 @@ def list_semantic_model_object_report_usage(
|
|
|
1504
1517
|
)
|
|
1505
1518
|
else:
|
|
1506
1519
|
df = pd.DataFrame(columns=["Table Name", "Object Name", "Object Type"])
|
|
1507
|
-
dep = get_model_calc_dependencies(dataset=
|
|
1520
|
+
dep = get_model_calc_dependencies(dataset=dataset_id, workspace=workspace_id)
|
|
1508
1521
|
|
|
1509
1522
|
for i, r in dfR.iterrows():
|
|
1510
1523
|
object_type = r["Object Type"]
|
|
@@ -1544,7 +1557,9 @@ def list_semantic_model_object_report_usage(
|
|
|
1544
1557
|
final_df["Object"] = format_dax_object_name(
|
|
1545
1558
|
final_df["Table Name"], final_df["Object Name"]
|
|
1546
1559
|
)
|
|
1547
|
-
dfC = fabric.list_columns(
|
|
1560
|
+
dfC = fabric.list_columns(
|
|
1561
|
+
dataset=dataset_id, workspace=workspace_id, extended=True
|
|
1562
|
+
)
|
|
1548
1563
|
dfC["Object"] = format_dax_object_name(dfC["Table Name"], dfC["Column Name"])
|
|
1549
1564
|
final_df = pd.merge(
|
|
1550
1565
|
final_df,
|
|
@@ -1583,8 +1598,8 @@ def list_server_properties(workspace: Optional[str | UUID] = None) -> pd.DataFra
|
|
|
1583
1598
|
|
|
1584
1599
|
Parameters
|
|
1585
1600
|
----------
|
|
1586
|
-
workspace : str, default=None
|
|
1587
|
-
The Fabric workspace name.
|
|
1601
|
+
workspace : str | uuid.UUID, default=None
|
|
1602
|
+
The Fabric workspace name or ID.
|
|
1588
1603
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
1589
1604
|
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
1590
1605
|
|
|
@@ -1626,9 +1641,9 @@ def list_semantic_model_errors(
|
|
|
1626
1641
|
|
|
1627
1642
|
Parameters
|
|
1628
1643
|
----------
|
|
1629
|
-
dataset : str | UUID
|
|
1644
|
+
dataset : str | uuid.UUID
|
|
1630
1645
|
Name or ID of the semantic model.
|
|
1631
|
-
workspace : str | UUID, default=None
|
|
1646
|
+
workspace : str | uuid.UUID, default=None
|
|
1632
1647
|
The Fabric workspace name or ID.
|
|
1633
1648
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
1634
1649
|
or if no lakehouse attached, resolves to the workspace of the notebook.
|