semantic-link-labs 0.8.11__py3-none-any.whl → 0.9.0__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.11.dist-info → semantic_link_labs-0.9.0.dist-info}/METADATA +5 -5
- {semantic_link_labs-0.8.11.dist-info → semantic_link_labs-0.9.0.dist-info}/RECORD +40 -40
- {semantic_link_labs-0.8.11.dist-info → semantic_link_labs-0.9.0.dist-info}/WHEEL +1 -1
- sempy_labs/__init__.py +29 -2
- sempy_labs/_authentication.py +80 -4
- sempy_labs/_capacities.py +770 -200
- sempy_labs/_capacity_migration.py +7 -37
- sempy_labs/_clear_cache.py +8 -8
- sempy_labs/_deployment_pipelines.py +1 -1
- sempy_labs/_gateways.py +2 -0
- sempy_labs/_generate_semantic_model.py +8 -0
- sempy_labs/_helper_functions.py +119 -79
- sempy_labs/_job_scheduler.py +138 -3
- sempy_labs/_list_functions.py +40 -31
- sempy_labs/_model_bpa.py +207 -204
- sempy_labs/_model_bpa_bulk.py +2 -2
- sempy_labs/_model_bpa_rules.py +3 -3
- sempy_labs/_notebooks.py +2 -0
- sempy_labs/_query_scale_out.py +8 -0
- sempy_labs/_sql.py +11 -7
- sempy_labs/_vertipaq.py +4 -2
- sempy_labs/_warehouses.py +6 -6
- sempy_labs/admin/_basic_functions.py +156 -103
- sempy_labs/admin/_domains.py +7 -2
- sempy_labs/admin/_git.py +4 -1
- sempy_labs/admin/_items.py +7 -2
- sempy_labs/admin/_scanner.py +7 -4
- sempy_labs/directlake/_directlake_schema_compare.py +7 -2
- sempy_labs/directlake/_directlake_schema_sync.py +6 -0
- sempy_labs/directlake/_dl_helper.py +51 -31
- sempy_labs/directlake/_get_directlake_lakehouse.py +20 -27
- sempy_labs/directlake/_update_directlake_partition_entity.py +5 -0
- sempy_labs/lakehouse/_get_lakehouse_columns.py +17 -22
- sempy_labs/lakehouse/_get_lakehouse_tables.py +20 -32
- sempy_labs/lakehouse/_lakehouse.py +2 -19
- sempy_labs/report/_generate_report.py +45 -0
- sempy_labs/report/_report_bpa.py +2 -2
- sempy_labs/tom/_model.py +97 -16
- {semantic_link_labs-0.8.11.dist-info → semantic_link_labs-0.9.0.dist-info}/LICENSE +0 -0
- {semantic_link_labs-0.8.11.dist-info → semantic_link_labs-0.9.0.dist-info}/top_level.txt +0 -0
sempy_labs/_warehouses.py
CHANGED
|
@@ -150,15 +150,15 @@ def delete_warehouse(name: str, workspace: Optional[str | UUID] = None):
|
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
def get_warehouse_tables(
|
|
153
|
-
warehouse: str, workspace: Optional[str | UUID] = None
|
|
153
|
+
warehouse: str | UUID, workspace: Optional[str | UUID] = None
|
|
154
154
|
) -> pd.DataFrame:
|
|
155
155
|
"""
|
|
156
156
|
Shows a list of the tables in the Fabric warehouse. This function is based on INFORMATION_SCHEMA.TABLES.
|
|
157
157
|
|
|
158
158
|
Parameters
|
|
159
159
|
----------
|
|
160
|
-
warehouse : str
|
|
161
|
-
Name of the Fabric warehouse.
|
|
160
|
+
warehouse : str | uuid.UUID
|
|
161
|
+
Name or ID of the Fabric warehouse.
|
|
162
162
|
workspace : str | uuid.UUID, default=None
|
|
163
163
|
The Fabric workspace name or ID.
|
|
164
164
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
@@ -185,15 +185,15 @@ def get_warehouse_tables(
|
|
|
185
185
|
|
|
186
186
|
|
|
187
187
|
def get_warehouse_columns(
|
|
188
|
-
warehouse: str, workspace: Optional[str | UUID] = None
|
|
188
|
+
warehouse: str | UUID, workspace: Optional[str | UUID] = None
|
|
189
189
|
) -> pd.DataFrame:
|
|
190
190
|
"""
|
|
191
191
|
Shows a list of the columns in each table within the Fabric warehouse. This function is based on INFORMATION_SCHEMA.COLUMNS.
|
|
192
192
|
|
|
193
193
|
Parameters
|
|
194
194
|
----------
|
|
195
|
-
warehouse : str
|
|
196
|
-
Name of the Fabric warehouse.
|
|
195
|
+
warehouse : str | uuid.UUID
|
|
196
|
+
Name or ID of the Fabric warehouse.
|
|
197
197
|
workspace : str | uuid.UUID, default=None
|
|
198
198
|
The Fabric workspace name or ID.
|
|
199
199
|
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
@@ -8,11 +8,14 @@ from sempy_labs._helper_functions import (
|
|
|
8
8
|
_is_valid_uuid,
|
|
9
9
|
_build_url,
|
|
10
10
|
)
|
|
11
|
+
from sempy._utils._log import log
|
|
11
12
|
import numpy as np
|
|
12
13
|
import pandas as pd
|
|
13
14
|
from dateutil.parser import parse as dtparser
|
|
15
|
+
import sempy_labs._authentication as auth
|
|
14
16
|
|
|
15
17
|
|
|
18
|
+
@log
|
|
16
19
|
def list_workspaces(
|
|
17
20
|
capacity: Optional[str | UUID] = None,
|
|
18
21
|
workspace: Optional[str | UUID] = None,
|
|
@@ -25,6 +28,8 @@ def list_workspaces(
|
|
|
25
28
|
|
|
26
29
|
This is a wrapper function for the following API: `Workspaces - List Workspaces - REST API (Admin) <https://learn.microsoft.com/en-us/rest/api/fabric/admin/workspaces/list-workspaces>`_.
|
|
27
30
|
|
|
31
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
32
|
+
|
|
28
33
|
Parameters
|
|
29
34
|
----------
|
|
30
35
|
capacity : str | uuid.UUID, default=None
|
|
@@ -59,7 +64,7 @@ def list_workspaces(
|
|
|
59
64
|
)
|
|
60
65
|
del kwargs["skip"]
|
|
61
66
|
|
|
62
|
-
client = fabric.FabricRestClient()
|
|
67
|
+
client = fabric.FabricRestClient(token_provider=auth.token_provider.get())
|
|
63
68
|
|
|
64
69
|
df = pd.DataFrame(
|
|
65
70
|
columns=[
|
|
@@ -121,6 +126,7 @@ def list_workspaces(
|
|
|
121
126
|
return df
|
|
122
127
|
|
|
123
128
|
|
|
129
|
+
@log
|
|
124
130
|
def list_capacities(
|
|
125
131
|
capacity: Optional[str | UUID] = None,
|
|
126
132
|
) -> pd.DataFrame:
|
|
@@ -129,6 +135,8 @@ def list_capacities(
|
|
|
129
135
|
|
|
130
136
|
This is a wrapper function for the following API: `Admin - Get Capacities As Admin <https://learn.microsoft.com/rest/api/power-bi/admin/get-capacities-as-admin>`_.
|
|
131
137
|
|
|
138
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
139
|
+
|
|
132
140
|
Parameters
|
|
133
141
|
----------
|
|
134
142
|
capacity : str | uuid.UUID, default=None
|
|
@@ -139,7 +147,7 @@ def list_capacities(
|
|
|
139
147
|
pandas.DataFrame
|
|
140
148
|
A pandas dataframe showing the capacities and their properties.
|
|
141
149
|
"""
|
|
142
|
-
client = fabric.FabricRestClient()
|
|
150
|
+
client = fabric.FabricRestClient(token_provider=auth.token_provider.get())
|
|
143
151
|
|
|
144
152
|
df = pd.DataFrame(
|
|
145
153
|
columns=["Capacity Id", "Capacity Name", "Sku", "Region", "State", "Admins"]
|
|
@@ -173,6 +181,7 @@ def list_capacities(
|
|
|
173
181
|
return df
|
|
174
182
|
|
|
175
183
|
|
|
184
|
+
@log
|
|
176
185
|
def assign_workspaces_to_capacity(
|
|
177
186
|
source_capacity: Optional[str | UUID] = None,
|
|
178
187
|
target_capacity: Optional[str | UUID] = None,
|
|
@@ -264,6 +273,7 @@ def assign_workspaces_to_capacity(
|
|
|
264
273
|
)
|
|
265
274
|
|
|
266
275
|
|
|
276
|
+
@log
|
|
267
277
|
def unassign_workspaces_from_capacity(
|
|
268
278
|
workspaces: str | List[str] | UUID | List[UUID],
|
|
269
279
|
):
|
|
@@ -305,18 +315,21 @@ def unassign_workspaces_from_capacity(
|
|
|
305
315
|
)
|
|
306
316
|
|
|
307
317
|
|
|
318
|
+
@log
|
|
308
319
|
def list_tenant_settings() -> pd.DataFrame:
|
|
309
320
|
"""
|
|
310
321
|
Lists all tenant settings.
|
|
311
322
|
|
|
312
323
|
This is a wrapper function for the following API: `Tenants - List Tenant Settings <https://learn.microsoft.com/rest/api/fabric/admin/tenants/list-tenant-settings>`_.
|
|
313
324
|
|
|
325
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
326
|
+
|
|
314
327
|
Returns
|
|
315
328
|
-------
|
|
316
329
|
pandas.DataFrame
|
|
317
330
|
A pandas dataframe showing the tenant settings.
|
|
318
331
|
"""
|
|
319
|
-
client = fabric.FabricRestClient()
|
|
332
|
+
client = fabric.FabricRestClient(token_provider=auth.token_provider.get())
|
|
320
333
|
|
|
321
334
|
response = client.get("/v1/admin/tenantsettings")
|
|
322
335
|
|
|
@@ -359,6 +372,8 @@ def list_capacities_delegated_tenant_settings(
|
|
|
359
372
|
|
|
360
373
|
This is a wrapper function for the following API: `Tenants - List Capacities Tenant Settings Overrides <https://learn.microsoft.com/rest/api/fabric/admin/tenants/list-capacities-tenant-settings-overrides>`_.
|
|
361
374
|
|
|
375
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
376
|
+
|
|
362
377
|
Parameters
|
|
363
378
|
----------
|
|
364
379
|
return_dataframe : bool, default=True
|
|
@@ -384,7 +399,7 @@ def list_capacities_delegated_tenant_settings(
|
|
|
384
399
|
]
|
|
385
400
|
)
|
|
386
401
|
|
|
387
|
-
client = fabric.FabricRestClient()
|
|
402
|
+
client = fabric.FabricRestClient(token_provider=auth.token_provider.get())
|
|
388
403
|
response = client.get("/v1/admin/capacities/delegatedTenantSettingOverrides")
|
|
389
404
|
|
|
390
405
|
if response.status_code != 200:
|
|
@@ -450,6 +465,8 @@ def list_modified_workspaces(
|
|
|
450
465
|
|
|
451
466
|
This is a wrapper function for the following API: `Admin - WorkspaceInfo GetModifiedWorkspaces <https://learn.microsoft.com/rest/api/power-bi/admin/workspace-info-get-modified-workspaces>`_.
|
|
452
467
|
|
|
468
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
469
|
+
|
|
453
470
|
Parameters
|
|
454
471
|
----------
|
|
455
472
|
modified_since : str, default=None
|
|
@@ -464,7 +481,7 @@ def list_modified_workspaces(
|
|
|
464
481
|
pandas.DataFrame
|
|
465
482
|
A pandas dataframe showing a list of workspace IDs in the organization.
|
|
466
483
|
"""
|
|
467
|
-
client = fabric.
|
|
484
|
+
client = fabric.FabricRestClient(token_provider=auth.token_provider.get())
|
|
468
485
|
|
|
469
486
|
params = {}
|
|
470
487
|
|
|
@@ -504,6 +521,8 @@ def list_datasets(
|
|
|
504
521
|
|
|
505
522
|
This is a wrapper function for the following API: `Admin - Datasets GetDatasetsAsAdmin <https://learn.microsoft.com/rest/api/power-bi/admin/datasets-get-datasets-as-admin>`_.
|
|
506
523
|
|
|
524
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
525
|
+
|
|
507
526
|
Parameters
|
|
508
527
|
----------
|
|
509
528
|
top : int, default=None
|
|
@@ -518,31 +537,32 @@ def list_datasets(
|
|
|
518
537
|
pandas.DataFrame
|
|
519
538
|
A pandas dataframe showing a list of datasets for the organization.
|
|
520
539
|
"""
|
|
521
|
-
df = pd.DataFrame(
|
|
522
|
-
columns=[
|
|
523
|
-
"Dataset Id",
|
|
524
|
-
"Dataset Name",
|
|
525
|
-
"Web URL",
|
|
526
|
-
"Add Rows API Enabled",
|
|
527
|
-
"Configured By",
|
|
528
|
-
"Is Refreshable",
|
|
529
|
-
"Is Effective Identity Required",
|
|
530
|
-
"Is Effective Identity Roles Required",
|
|
531
|
-
"Target Storage Mode",
|
|
532
|
-
"Created Date",
|
|
533
|
-
"Content Provider Type",
|
|
534
|
-
"Create Report Embed URL",
|
|
535
|
-
"QnA Embed URL",
|
|
536
|
-
"Upstream Datasets",
|
|
537
|
-
"Users",
|
|
538
|
-
"Is In Place Sharing Enabled",
|
|
539
|
-
"Workspace Id",
|
|
540
|
-
"Auto Sync Read Only Replicas",
|
|
541
|
-
"Max Read Only Replicas",
|
|
542
|
-
]
|
|
543
|
-
)
|
|
544
540
|
|
|
545
|
-
|
|
541
|
+
columns = [
|
|
542
|
+
"Dataset Id",
|
|
543
|
+
"Dataset Name",
|
|
544
|
+
"Web URL",
|
|
545
|
+
"Add Rows API Enabled",
|
|
546
|
+
"Configured By",
|
|
547
|
+
"Is Refreshable",
|
|
548
|
+
"Is Effective Identity Required",
|
|
549
|
+
"Is Effective Identity Roles Required",
|
|
550
|
+
"Target Storage Mode",
|
|
551
|
+
"Created Date",
|
|
552
|
+
"Content Provider Type",
|
|
553
|
+
"Create Report Embed URL",
|
|
554
|
+
"QnA Embed URL",
|
|
555
|
+
"Upstream Datasets",
|
|
556
|
+
"Users",
|
|
557
|
+
"Is In Place Sharing Enabled",
|
|
558
|
+
"Workspace Id",
|
|
559
|
+
"Auto Sync Read Only Replicas",
|
|
560
|
+
"Max Read Only Replicas",
|
|
561
|
+
]
|
|
562
|
+
|
|
563
|
+
df = pd.DataFrame(columns=columns)
|
|
564
|
+
|
|
565
|
+
client = fabric.FabricRestClient(token_provider=auth.token_provider.get())
|
|
546
566
|
|
|
547
567
|
params = {}
|
|
548
568
|
url = "/v1.0/myorg/admin/datasets"
|
|
@@ -563,35 +583,40 @@ def list_datasets(
|
|
|
563
583
|
if response.status_code != 200:
|
|
564
584
|
raise FabricHTTPException(response)
|
|
565
585
|
|
|
586
|
+
rows = []
|
|
566
587
|
for v in response.json().get("value", []):
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
"
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
"
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
"
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
588
|
+
rows.append(
|
|
589
|
+
{
|
|
590
|
+
"Dataset Id": v.get("id"),
|
|
591
|
+
"Dataset Name": v.get("name"),
|
|
592
|
+
"Web URL": v.get("webUrl"),
|
|
593
|
+
"Add Rows API Enabled": v.get("addRowsAPIEnabled"),
|
|
594
|
+
"Configured By": v.get("configuredBy"),
|
|
595
|
+
"Is Refreshable": v.get("isRefreshable"),
|
|
596
|
+
"Is Effective Identity Required": v.get("isEffectiveIdentityRequired"),
|
|
597
|
+
"Is Effective Identity Roles Required": v.get(
|
|
598
|
+
"isEffectiveIdentityRolesRequired"
|
|
599
|
+
),
|
|
600
|
+
"Target Storage Mode": v.get("targetStorageMode"),
|
|
601
|
+
"Created Date": pd.to_datetime(v.get("createdDate")),
|
|
602
|
+
"Content Provider Type": v.get("contentProviderType"),
|
|
603
|
+
"Create Report Embed URL": v.get("createReportEmbedURL"),
|
|
604
|
+
"QnA Embed URL": v.get("qnaEmbedURL"),
|
|
605
|
+
"Upstream Datasets": v.get("upstreamDatasets", []),
|
|
606
|
+
"Users": v.get("users", []),
|
|
607
|
+
"Is In Place Sharing Enabled": v.get("isInPlaceSharingEnabled"),
|
|
608
|
+
"Workspace Id": v.get("workspaceId"),
|
|
609
|
+
"Auto Sync Read Only Replicas": v.get("queryScaleOutSettings", {}).get(
|
|
610
|
+
"autoSyncReadOnlyReplicas"
|
|
611
|
+
),
|
|
612
|
+
"Max Read Only Replicas": v.get("queryScaleOutSettings", {}).get(
|
|
613
|
+
"maxReadOnlyReplicas"
|
|
614
|
+
),
|
|
615
|
+
}
|
|
616
|
+
)
|
|
617
|
+
|
|
618
|
+
if rows:
|
|
619
|
+
df = pd.DataFrame(rows, columns=columns)
|
|
595
620
|
|
|
596
621
|
bool_cols = [
|
|
597
622
|
"Add Rows API Enabled",
|
|
@@ -617,6 +642,8 @@ def list_access_entities(
|
|
|
617
642
|
|
|
618
643
|
This is a wrapper function for the following API: `Users - List Access Entities <https://learn.microsoft.com/rest/api/fabric/admin/users/list-access-entities>`_.
|
|
619
644
|
|
|
645
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
646
|
+
|
|
620
647
|
Parameters
|
|
621
648
|
----------
|
|
622
649
|
user_email_address : str
|
|
@@ -636,7 +663,7 @@ def list_access_entities(
|
|
|
636
663
|
"Additional Permissions",
|
|
637
664
|
]
|
|
638
665
|
)
|
|
639
|
-
client = fabric.FabricRestClient()
|
|
666
|
+
client = fabric.FabricRestClient(token_provider=auth.token_provider.get())
|
|
640
667
|
|
|
641
668
|
response = client.get(f"/v1/admin/users/{user_email_address}/access")
|
|
642
669
|
|
|
@@ -662,13 +689,15 @@ def list_access_entities(
|
|
|
662
689
|
|
|
663
690
|
|
|
664
691
|
def list_workspace_access_details(
|
|
665
|
-
workspace: Optional[Union[str, UUID]] = None
|
|
692
|
+
workspace: Optional[Union[str, UUID]] = None,
|
|
666
693
|
) -> pd.DataFrame:
|
|
667
694
|
"""
|
|
668
695
|
Shows a list of users (including groups and Service Principals) that have access to the specified workspace.
|
|
669
696
|
|
|
670
697
|
This is a wrapper function for the following API: `Workspaces - List Workspace Access Details <https://learn.microsoft.com/rest/api/fabric/admin/workspaces/list-workspace-access-details>`_.
|
|
671
698
|
|
|
699
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
700
|
+
|
|
672
701
|
Parameters
|
|
673
702
|
----------
|
|
674
703
|
workspace : str | uuid.UUID, default=None
|
|
@@ -681,7 +710,7 @@ def list_workspace_access_details(
|
|
|
681
710
|
pandas.DataFrame
|
|
682
711
|
A pandas dataframe showing a list of users (including groups and Service Principals) that have access to the specified workspace.
|
|
683
712
|
"""
|
|
684
|
-
workspace_name, workspace_id = _resolve_workspace_name_and_id(workspace)
|
|
713
|
+
(workspace_name, workspace_id) = _resolve_workspace_name_and_id(workspace)
|
|
685
714
|
|
|
686
715
|
df = pd.DataFrame(
|
|
687
716
|
columns=[
|
|
@@ -694,7 +723,7 @@ def list_workspace_access_details(
|
|
|
694
723
|
]
|
|
695
724
|
)
|
|
696
725
|
|
|
697
|
-
client = fabric.FabricRestClient()
|
|
726
|
+
client = fabric.FabricRestClient(token_provider=auth.token_provider.get())
|
|
698
727
|
|
|
699
728
|
response = client.get(f"/v1/admin/workspaces/{workspace_id}/users")
|
|
700
729
|
if response.status_code != 200:
|
|
@@ -726,6 +755,8 @@ def list_activity_events(
|
|
|
726
755
|
|
|
727
756
|
This is a wrapper function for the following API: `Admin - Get Activity Events <https://learn.microsoft.com/rest/api/power-bi/admin/get-activity-events>`_.
|
|
728
757
|
|
|
758
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
759
|
+
|
|
729
760
|
Parameters
|
|
730
761
|
----------
|
|
731
762
|
start_time : str
|
|
@@ -796,7 +827,7 @@ def list_activity_events(
|
|
|
796
827
|
)
|
|
797
828
|
|
|
798
829
|
response_json = {"activityEventEntities": []}
|
|
799
|
-
client = fabric.
|
|
830
|
+
client = fabric.FabricRestClient(token_provider=auth.token_provider.get())
|
|
800
831
|
url = f"/v1.0/myorg/admin/activityevents?startDateTime='{start_time}'&endDateTime='{end_time}'"
|
|
801
832
|
|
|
802
833
|
conditions = []
|
|
@@ -949,38 +980,51 @@ def _resolve_workspace_name_and_id(
|
|
|
949
980
|
|
|
950
981
|
|
|
951
982
|
def list_reports(
|
|
952
|
-
top: Optional[int] = None,
|
|
983
|
+
top: Optional[int] = None,
|
|
984
|
+
skip: Optional[int] = None,
|
|
985
|
+
filter: Optional[str] = None,
|
|
953
986
|
) -> pd.DataFrame:
|
|
954
987
|
"""
|
|
955
988
|
Shows a list of reports for the organization.
|
|
956
989
|
|
|
957
990
|
This is a wrapper function for the following API: `Admin - Reports GetReportsAsAdmin <https://learn.microsoft.com/rest/api/power-bi/admin/reports-get-reports-as-admin>`_.
|
|
958
991
|
|
|
992
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
993
|
+
|
|
994
|
+
Parameters
|
|
995
|
+
----------
|
|
996
|
+
top : int, default=None
|
|
997
|
+
Returns only the first n results.
|
|
998
|
+
skip : int, default=None
|
|
999
|
+
Skips the first n results.
|
|
1000
|
+
filter : str, default=None
|
|
1001
|
+
Returns a subset of a results based on Odata filter query parameter condition.
|
|
1002
|
+
|
|
959
1003
|
Returns
|
|
960
1004
|
-------
|
|
961
1005
|
pandas.DataFrame
|
|
962
1006
|
A pandas dataframe showing a list of reports for the organization.
|
|
963
1007
|
"""
|
|
964
1008
|
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
)
|
|
1009
|
+
columns = [
|
|
1010
|
+
"Report Id",
|
|
1011
|
+
"Report Name",
|
|
1012
|
+
"Type",
|
|
1013
|
+
"Web URL",
|
|
1014
|
+
"Embed URL",
|
|
1015
|
+
"Dataset Id",
|
|
1016
|
+
"Created Date",
|
|
1017
|
+
"Modified Date",
|
|
1018
|
+
"Created By",
|
|
1019
|
+
"Modified By",
|
|
1020
|
+
"Sensitivity Label Id",
|
|
1021
|
+
"Users",
|
|
1022
|
+
"Subscriptions",
|
|
1023
|
+
"Workspace Id",
|
|
1024
|
+
"Report Flags",
|
|
1025
|
+
]
|
|
1026
|
+
|
|
1027
|
+
df = pd.DataFrame(columns=columns)
|
|
984
1028
|
|
|
985
1029
|
url = "/v1.0/myorg/admin/reports?"
|
|
986
1030
|
if top is not None:
|
|
@@ -992,31 +1036,36 @@ def list_reports(
|
|
|
992
1036
|
|
|
993
1037
|
url.rstrip("$").rstrip("?")
|
|
994
1038
|
|
|
995
|
-
client = fabric.
|
|
1039
|
+
client = fabric.FabricRestClient(token_provider=auth.token_provider.get())
|
|
996
1040
|
response = client.get(url)
|
|
997
1041
|
|
|
998
1042
|
if response.status_code != 200:
|
|
999
1043
|
raise FabricHTTPException(response)
|
|
1000
1044
|
|
|
1045
|
+
rows = []
|
|
1001
1046
|
for v in response.json().get("value", []):
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1047
|
+
rows.append(
|
|
1048
|
+
{
|
|
1049
|
+
"Report Id": v.get("id"),
|
|
1050
|
+
"Report Name": v.get("name"),
|
|
1051
|
+
"Type": v.get("reportType"),
|
|
1052
|
+
"Web URL": v.get("webUrl"),
|
|
1053
|
+
"Embed URL": v.get("embedUrl"),
|
|
1054
|
+
"Dataset Id": v.get("datasetId"),
|
|
1055
|
+
"Created Date": v.get("createdDateTime"),
|
|
1056
|
+
"Modified Date": v.get("modifiedDateTime"),
|
|
1057
|
+
"Created By": v.get("createdBy"),
|
|
1058
|
+
"Modified By": v.get("modifiedBy"),
|
|
1059
|
+
"Sensitivity Label Id": v.get("sensitivityLabel", {}).get("labelId"),
|
|
1060
|
+
"Users": v.get("users"),
|
|
1061
|
+
"Subscriptions": v.get("subscriptions"),
|
|
1062
|
+
"Workspace Id": v.get("workspaceId"),
|
|
1063
|
+
"Report Flags": v.get("reportFlags"),
|
|
1064
|
+
}
|
|
1065
|
+
)
|
|
1066
|
+
|
|
1067
|
+
if rows:
|
|
1068
|
+
df = pd.DataFrame(rows, columns=columns)
|
|
1020
1069
|
|
|
1021
1070
|
int_cols = ["Report Flags"]
|
|
1022
1071
|
df[int_cols] = df[int_cols].astype(int)
|
|
@@ -1027,12 +1076,16 @@ def list_reports(
|
|
|
1027
1076
|
return df
|
|
1028
1077
|
|
|
1029
1078
|
|
|
1030
|
-
def get_capacity_assignment_status(
|
|
1079
|
+
def get_capacity_assignment_status(
|
|
1080
|
+
workspace: Optional[str | UUID] = None,
|
|
1081
|
+
) -> pd.DataFrame:
|
|
1031
1082
|
"""
|
|
1032
1083
|
Gets the status of the assignment-to-capacity operation for the specified workspace.
|
|
1033
1084
|
|
|
1034
1085
|
This is a wrapper function for the following API: `Capacities - Groups CapacityAssignmentStatus <https://learn.microsoft.com/rest/api/power-bi/capacities/groups-capacity-assignment-status>`_.
|
|
1035
1086
|
|
|
1087
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
1088
|
+
|
|
1036
1089
|
Parameters
|
|
1037
1090
|
----------
|
|
1038
1091
|
workspace : str | uuid.UUID, default=None
|
|
@@ -1059,7 +1112,7 @@ def get_capacity_assignment_status(workspace: Optional[str | UUID] = None):
|
|
|
1059
1112
|
]
|
|
1060
1113
|
)
|
|
1061
1114
|
|
|
1062
|
-
client = fabric.FabricRestClient()
|
|
1115
|
+
client = fabric.FabricRestClient(token_provider=auth.token_provider.get())
|
|
1063
1116
|
response = client.get(f"/v1.0/myorg/groups/{workspace_id}/CapacityAssignmentStatus")
|
|
1064
1117
|
|
|
1065
1118
|
if response.status_code != 200:
|
sempy_labs/admin/_domains.py
CHANGED
|
@@ -6,6 +6,7 @@ from sempy.fabric.exceptions import FabricHTTPException
|
|
|
6
6
|
import pandas as pd
|
|
7
7
|
from uuid import UUID
|
|
8
8
|
from sempy_labs.admin._basic_functions import list_workspaces
|
|
9
|
+
import sempy_labs._authentication as auth
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
def resolve_domain_id(domain_name: str) -> UUID:
|
|
@@ -37,6 +38,8 @@ def list_domains(non_empty_only: bool = False) -> pd.DataFrame:
|
|
|
37
38
|
|
|
38
39
|
This is a wrapper function for the following API: `Domains - List Domains <https://learn.microsoft.com/rest/api/fabric/admin/domains/list-domains>`_.
|
|
39
40
|
|
|
41
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
42
|
+
|
|
40
43
|
Parameters
|
|
41
44
|
----------
|
|
42
45
|
non_empty_only : bool, default=False
|
|
@@ -59,7 +62,7 @@ def list_domains(non_empty_only: bool = False) -> pd.DataFrame:
|
|
|
59
62
|
]
|
|
60
63
|
)
|
|
61
64
|
|
|
62
|
-
client = fabric.FabricRestClient()
|
|
65
|
+
client = fabric.FabricRestClient(token_provider=auth.token_provider.get())
|
|
63
66
|
url = "/v1/admin/domains"
|
|
64
67
|
if non_empty_only:
|
|
65
68
|
url = f"{url}?nonEmptyOnly=True"
|
|
@@ -87,6 +90,8 @@ def list_domain_workspaces(domain_name: str) -> pd.DataFrame:
|
|
|
87
90
|
|
|
88
91
|
This is a wrapper function for the following API: `Domains - List Domain Workspaces <https://learn.microsoft.com/rest/api/fabric/admin/domains/list-domain-workspaces>`_.
|
|
89
92
|
|
|
93
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
94
|
+
|
|
90
95
|
Parameters
|
|
91
96
|
----------
|
|
92
97
|
domain_name : str
|
|
@@ -102,7 +107,7 @@ def list_domain_workspaces(domain_name: str) -> pd.DataFrame:
|
|
|
102
107
|
|
|
103
108
|
df = pd.DataFrame(columns=["Workspace ID", "Workspace Name"])
|
|
104
109
|
|
|
105
|
-
client = fabric.FabricRestClient()
|
|
110
|
+
client = fabric.FabricRestClient(token_provider=auth.token_provider.get())
|
|
106
111
|
response = client.get(f"/v1/admin/domains/{domain_id}/workspaces")
|
|
107
112
|
|
|
108
113
|
if response.status_code != 200:
|
sempy_labs/admin/_git.py
CHANGED
|
@@ -5,6 +5,7 @@ from sempy_labs._helper_functions import (
|
|
|
5
5
|
)
|
|
6
6
|
import pandas as pd
|
|
7
7
|
from sempy_labs.admin._basic_functions import list_workspaces
|
|
8
|
+
import sempy_labs._authentication as auth
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
def list_git_connections() -> pd.DataFrame:
|
|
@@ -13,13 +14,15 @@ def list_git_connections() -> pd.DataFrame:
|
|
|
13
14
|
|
|
14
15
|
This is a wrapper function for the following API: `Workspaces - List Git Connections <https://learn.microsoft.com/rest/api/fabric/admin/workspaces/list-git-connections>`_.
|
|
15
16
|
|
|
17
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
18
|
+
|
|
16
19
|
Returns
|
|
17
20
|
-------
|
|
18
21
|
pandas.DataFrame
|
|
19
22
|
A pandas dataframe showing a list of Git connections.
|
|
20
23
|
"""
|
|
21
24
|
|
|
22
|
-
client = fabric.FabricRestClient()
|
|
25
|
+
client = fabric.FabricRestClient(token_provider=auth.token_provider.get())
|
|
23
26
|
response = client.get("/v1/admin/workspaces/discoverGitConnections")
|
|
24
27
|
|
|
25
28
|
df = pd.DataFrame(
|
sempy_labs/admin/_items.py
CHANGED
|
@@ -13,6 +13,7 @@ from sempy_labs._helper_functions import (
|
|
|
13
13
|
_is_valid_uuid,
|
|
14
14
|
_build_url,
|
|
15
15
|
)
|
|
16
|
+
import sempy_labs._authentication as auth
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
def _resolve_item_id(
|
|
@@ -76,6 +77,8 @@ def list_items(
|
|
|
76
77
|
|
|
77
78
|
This is a wrapper function for the following API: `Items - List Items <https://learn.microsoft.com/rest/api/fabric/admin/items/list-items>`_.
|
|
78
79
|
|
|
80
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
81
|
+
|
|
79
82
|
Parameters
|
|
80
83
|
----------
|
|
81
84
|
capacity : str | uuid.UUID, default=None
|
|
@@ -120,7 +123,7 @@ def list_items(
|
|
|
120
123
|
]
|
|
121
124
|
)
|
|
122
125
|
|
|
123
|
-
client = fabric.FabricRestClient()
|
|
126
|
+
client = fabric.FabricRestClient(token_provider=auth.token_provider.get())
|
|
124
127
|
|
|
125
128
|
params = {}
|
|
126
129
|
|
|
@@ -189,6 +192,8 @@ def list_item_access_details(
|
|
|
189
192
|
|
|
190
193
|
This is a wrapper function for the following API: `Items - List Item Access Details <https://learn.microsoft.com/rest/api/fabric/admin/items/list-item-access-details>`_.
|
|
191
194
|
|
|
195
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
196
|
+
|
|
192
197
|
Parameters
|
|
193
198
|
----------
|
|
194
199
|
item : str
|
|
@@ -217,7 +222,7 @@ def list_item_access_details(
|
|
|
217
222
|
f"{icons.red_dot} The parameter 'item' and 'type' are mandatory."
|
|
218
223
|
)
|
|
219
224
|
|
|
220
|
-
client = fabric.FabricRestClient()
|
|
225
|
+
client = fabric.FabricRestClient(token_provider=auth.token_provider.get())
|
|
221
226
|
|
|
222
227
|
workspace_name, workspace_id = _resolve_workspace_name_and_id(workspace)
|
|
223
228
|
item_name, item_id = _resolve_item_name_and_id(
|