semantic-link-labs 0.9.0__py3-none-any.whl → 0.9.2__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.

Files changed (83) hide show
  1. {semantic_link_labs-0.9.0.dist-info → semantic_link_labs-0.9.2.dist-info}/METADATA +68 -7
  2. {semantic_link_labs-0.9.0.dist-info → semantic_link_labs-0.9.2.dist-info}/RECORD +83 -76
  3. sempy_labs/__init__.py +14 -12
  4. sempy_labs/_authentication.py +0 -2
  5. sempy_labs/_capacities.py +120 -142
  6. sempy_labs/_capacity_migration.py +61 -94
  7. sempy_labs/_clear_cache.py +9 -8
  8. sempy_labs/_connections.py +72 -105
  9. sempy_labs/_data_pipelines.py +47 -49
  10. sempy_labs/_dataflows.py +45 -51
  11. sempy_labs/_dax.py +228 -6
  12. sempy_labs/_delta_analyzer.py +303 -0
  13. sempy_labs/_deployment_pipelines.py +72 -66
  14. sempy_labs/_environments.py +39 -36
  15. sempy_labs/_eventhouses.py +35 -35
  16. sempy_labs/_eventstreams.py +38 -39
  17. sempy_labs/_external_data_shares.py +29 -42
  18. sempy_labs/_gateways.py +57 -101
  19. sempy_labs/_generate_semantic_model.py +22 -30
  20. sempy_labs/_git.py +46 -66
  21. sempy_labs/_graphQL.py +95 -0
  22. sempy_labs/_helper_functions.py +175 -30
  23. sempy_labs/_job_scheduler.py +47 -59
  24. sempy_labs/_kql_databases.py +27 -34
  25. sempy_labs/_kql_querysets.py +23 -30
  26. sempy_labs/_list_functions.py +262 -164
  27. sempy_labs/_managed_private_endpoints.py +52 -47
  28. sempy_labs/_mirrored_databases.py +110 -134
  29. sempy_labs/_mirrored_warehouses.py +13 -13
  30. sempy_labs/_ml_experiments.py +36 -36
  31. sempy_labs/_ml_models.py +37 -38
  32. sempy_labs/_model_dependencies.py +2 -0
  33. sempy_labs/_notebooks.py +28 -29
  34. sempy_labs/_one_lake_integration.py +2 -0
  35. sempy_labs/_query_scale_out.py +63 -81
  36. sempy_labs/_refresh_semantic_model.py +12 -14
  37. sempy_labs/_spark.py +54 -79
  38. sempy_labs/_sql.py +7 -11
  39. sempy_labs/_vertipaq.py +8 -3
  40. sempy_labs/_warehouses.py +30 -33
  41. sempy_labs/_workloads.py +15 -20
  42. sempy_labs/_workspace_identity.py +13 -17
  43. sempy_labs/_workspaces.py +49 -48
  44. sempy_labs/admin/__init__.py +2 -0
  45. sempy_labs/admin/_basic_functions.py +244 -281
  46. sempy_labs/admin/_domains.py +188 -103
  47. sempy_labs/admin/_external_data_share.py +26 -31
  48. sempy_labs/admin/_git.py +17 -22
  49. sempy_labs/admin/_items.py +34 -48
  50. sempy_labs/admin/_scanner.py +20 -13
  51. sempy_labs/directlake/_directlake_schema_compare.py +2 -0
  52. sempy_labs/directlake/_dl_helper.py +10 -11
  53. sempy_labs/directlake/_generate_shared_expression.py +4 -5
  54. sempy_labs/directlake/_get_directlake_lakehouse.py +1 -0
  55. sempy_labs/directlake/_list_directlake_model_calc_tables.py +1 -0
  56. sempy_labs/directlake/_show_unsupported_directlake_objects.py +2 -0
  57. sempy_labs/directlake/_warm_cache.py +2 -0
  58. sempy_labs/graph/__init__.py +33 -0
  59. sempy_labs/graph/_groups.py +402 -0
  60. sempy_labs/graph/_teams.py +113 -0
  61. sempy_labs/graph/_users.py +191 -0
  62. sempy_labs/lakehouse/__init__.py +4 -0
  63. sempy_labs/lakehouse/_get_lakehouse_columns.py +10 -10
  64. sempy_labs/lakehouse/_get_lakehouse_tables.py +14 -20
  65. sempy_labs/lakehouse/_lakehouse.py +101 -4
  66. sempy_labs/lakehouse/_shortcuts.py +42 -20
  67. sempy_labs/migration/__init__.py +4 -0
  68. sempy_labs/migration/_direct_lake_to_import.py +66 -0
  69. sempy_labs/migration/_migrate_calctables_to_lakehouse.py +1 -0
  70. sempy_labs/migration/_migrate_calctables_to_semantic_model.py +1 -0
  71. sempy_labs/migration/_migrate_model_objects_to_semantic_model.py +1 -0
  72. sempy_labs/migration/_migrate_tables_columns_to_semantic_model.py +2 -0
  73. sempy_labs/report/_download_report.py +8 -13
  74. sempy_labs/report/_generate_report.py +49 -46
  75. sempy_labs/report/_paginated.py +20 -26
  76. sempy_labs/report/_report_functions.py +50 -45
  77. sempy_labs/report/_report_list_functions.py +2 -0
  78. sempy_labs/report/_report_rebind.py +6 -10
  79. sempy_labs/report/_reportwrapper.py +187 -220
  80. sempy_labs/tom/_model.py +8 -5
  81. {semantic_link_labs-0.9.0.dist-info → semantic_link_labs-0.9.2.dist-info}/LICENSE +0 -0
  82. {semantic_link_labs-0.9.0.dist-info → semantic_link_labs-0.9.2.dist-info}/WHEEL +0 -0
  83. {semantic_link_labs-0.9.0.dist-info → semantic_link_labs-0.9.2.dist-info}/top_level.txt +0 -0
sempy_labs/_workspaces.py CHANGED
@@ -1,13 +1,12 @@
1
- import sempy.fabric as fabric
2
1
  import pandas as pd
3
2
  import sempy_labs._icons as icons
4
3
  from typing import Optional
5
4
  from sempy_labs._helper_functions import (
6
5
  resolve_workspace_name_and_id,
7
- pagination,
8
6
  resolve_capacity_id,
7
+ _base_api,
8
+ _create_dataframe,
9
9
  )
10
- from sempy.fabric.exceptions import FabricHTTPException
11
10
  from uuid import UUID
12
11
 
13
12
 
@@ -31,11 +30,10 @@ def delete_user_from_workspace(
31
30
 
32
31
  (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
33
32
 
34
- client = fabric.PowerBIRestClient()
35
- response = client.delete(f"/v1.0/myorg/groups/{workspace_id}/users/{email_address}")
36
-
37
- if response.status_code != 200:
38
- raise FabricHTTPException(response)
33
+ _base_api(
34
+ request=f"/v1.0/myorg/groups/{workspace_id}/users/{email_address}",
35
+ method="delete",
36
+ )
39
37
  print(
40
38
  f"{icons.green_dot} The '{email_address}' user has been removed from accessing the '{workspace_name}' workspace."
41
39
  )
@@ -81,18 +79,18 @@ def update_workspace_user(
81
79
  f"{icons.red_dot} Invalid princpal type. Valid options: {principal_types}."
82
80
  )
83
81
 
84
- request_body = {
82
+ payload = {
85
83
  "emailAddress": email_address,
86
84
  "groupUserAccessRight": role_name,
87
85
  "principalType": principal_type,
88
86
  "identifier": email_address,
89
87
  }
90
88
 
91
- client = fabric.PowerBIRestClient()
92
- response = client.put(f"/v1.0/myorg/groups/{workspace_id}/users", json=request_body)
93
-
94
- if response.status_code != 200:
95
- raise FabricHTTPException(response)
89
+ _base_api(
90
+ request=f"/v1.0/myorg/groups/{workspace_id}/users",
91
+ method="put",
92
+ payload=payload,
93
+ )
96
94
  print(
97
95
  f"{icons.green_dot} The '{email_address}' user has been updated to a '{role_name}' within the '{workspace_name}' workspace."
98
96
  )
@@ -119,13 +117,18 @@ def list_workspace_users(workspace: Optional[str | UUID] = None) -> pd.DataFrame
119
117
 
120
118
  (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
121
119
 
122
- df = pd.DataFrame(columns=["User Name", "Email Address", "Role", "Type", "User ID"])
123
- client = fabric.FabricRestClient()
124
- response = client.get(f"/v1/workspaces/{workspace_id}/roleAssignments")
125
- if response.status_code != 200:
126
- raise FabricHTTPException(response)
120
+ columns = {
121
+ "User Name": "string",
122
+ "Email Address": "string",
123
+ "Role": "string",
124
+ "Type": "string",
125
+ "User ID": "string",
126
+ }
127
+ df = _create_dataframe(columns=columns)
127
128
 
128
- responses = pagination(client, response)
129
+ responses = _base_api(
130
+ request=f"v1/workspaces/{workspace_id}/roleAssignments", uses_pagination=True
131
+ )
129
132
 
130
133
  for r in responses:
131
134
  for v in r.get("value", []):
@@ -183,21 +186,18 @@ def add_user_to_workspace(
183
186
  f"{icons.red_dot} Invalid princpal type. Valid options: {principal_types}."
184
187
  )
185
188
 
186
- client = fabric.PowerBIRestClient()
187
-
188
- request_body = {
189
+ payload = {
189
190
  "emailAddress": email_address,
190
191
  "groupUserAccessRight": role_name,
191
192
  "principalType": principal_type,
192
193
  "identifier": email_address,
193
194
  }
194
195
 
195
- response = client.post(
196
- f"/v1.0/myorg/groups/{workspace_id}/users", json=request_body
196
+ _base_api(
197
+ request=f"/v1.0/myorg/groups/{workspace_id}/users",
198
+ method="post",
199
+ payload=payload,
197
200
  )
198
-
199
- if response.status_code != 200:
200
- raise FabricHTTPException(response)
201
201
  print(
202
202
  f"{icons.green_dot} The '{email_address}' user has been added as a{plural} '{role_name}' within the '{workspace_name}' workspace."
203
203
  )
@@ -224,16 +224,14 @@ def assign_workspace_to_capacity(
224
224
  (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
225
225
  capacity_id = resolve_capacity_id(capacity_name=capacity_name)
226
226
 
227
- request_body = {"capacityId": capacity_id}
227
+ payload = {"capacityId": capacity_id}
228
228
 
229
- client = fabric.FabricRestClient()
230
- response = client.post(
231
- f"/v1/workspaces/{workspace_id}/assignToCapacity",
232
- json=request_body,
229
+ _base_api(
230
+ request=f"/v1/workspaces/{workspace_id}/assignToCapacity",
231
+ method="post",
232
+ payload=payload,
233
+ status_codes=[200, 202],
233
234
  )
234
-
235
- if response.status_code not in [200, 202]:
236
- raise FabricHTTPException(response)
237
235
  print(
238
236
  f"{icons.green_dot} The '{workspace_name}' workspace has been assigned to the '{capacity_name}' capacity."
239
237
  )
@@ -255,11 +253,11 @@ def unassign_workspace_from_capacity(workspace: Optional[str | UUID] = None):
255
253
 
256
254
  (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
257
255
 
258
- client = fabric.FabricRestClient()
259
- response = client.post(f"/v1/workspaces/{workspace_id}/unassignFromCapacity")
260
-
261
- if response.status_code not in [200, 202]:
262
- raise FabricHTTPException(response)
256
+ _base_api(
257
+ request=f"/v1/workspaces/{workspace_id}/unassignFromCapacity",
258
+ method="post",
259
+ status_codes=[200, 202],
260
+ )
263
261
  print(
264
262
  f"{icons.green_dot} The '{workspace_name}' workspace has been unassigned from its capacity."
265
263
  )
@@ -288,14 +286,17 @@ def list_workspace_role_assignments(
288
286
 
289
287
  (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
290
288
 
291
- df = pd.DataFrame(columns=["User Name", "User Email", "Role Name", "Type"])
292
-
293
- client = fabric.FabricRestClient()
294
- response = client.get(f"/v1/workspaces/{workspace_id}/roleAssignments")
295
- if response.status_code != 200:
296
- raise FabricHTTPException(response)
289
+ columns = {
290
+ "User Name": "string",
291
+ "User Email": "string",
292
+ "Role Name": "string",
293
+ "Type": "string",
294
+ }
295
+ df = _create_dataframe(columns=columns)
297
296
 
298
- responses = pagination(client, response)
297
+ responses = _base_api(
298
+ request=f"v1/workspaces/{workspace_id}/roleAssignments", uses_pagination=True
299
+ )
299
300
 
300
301
  for r in responses:
301
302
  for i in r.get("value", []):
@@ -15,6 +15,7 @@ from sempy_labs.admin._basic_functions import (
15
15
  list_access_entities,
16
16
  list_activity_events,
17
17
  get_capacity_assignment_status,
18
+ get_capacity_state,
18
19
  )
19
20
  from sempy_labs.admin._domains import (
20
21
  list_domains,
@@ -70,4 +71,5 @@ __all__ = [
70
71
  "list_reports",
71
72
  "get_capacity_assignment_status",
72
73
  "scan_workspaces",
74
+ "get_capacity_state",
73
75
  ]