semantic-link-labs 0.8.10__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.

Files changed (81) hide show
  1. {semantic_link_labs-0.8.10.dist-info → semantic_link_labs-0.9.0.dist-info}/METADATA +6 -5
  2. {semantic_link_labs-0.8.10.dist-info → semantic_link_labs-0.9.0.dist-info}/RECORD +81 -80
  3. {semantic_link_labs-0.8.10.dist-info → semantic_link_labs-0.9.0.dist-info}/WHEEL +1 -1
  4. sempy_labs/__init__.py +34 -3
  5. sempy_labs/_authentication.py +80 -4
  6. sempy_labs/_capacities.py +770 -200
  7. sempy_labs/_capacity_migration.py +7 -37
  8. sempy_labs/_clear_cache.py +37 -35
  9. sempy_labs/_connections.py +13 -13
  10. sempy_labs/_data_pipelines.py +20 -20
  11. sempy_labs/_dataflows.py +27 -28
  12. sempy_labs/_dax.py +41 -47
  13. sempy_labs/_deployment_pipelines.py +1 -1
  14. sempy_labs/_environments.py +26 -23
  15. sempy_labs/_eventhouses.py +16 -15
  16. sempy_labs/_eventstreams.py +16 -15
  17. sempy_labs/_external_data_shares.py +18 -20
  18. sempy_labs/_gateways.py +16 -14
  19. sempy_labs/_generate_semantic_model.py +107 -62
  20. sempy_labs/_git.py +105 -43
  21. sempy_labs/_helper_functions.py +251 -194
  22. sempy_labs/_job_scheduler.py +227 -0
  23. sempy_labs/_kql_databases.py +16 -15
  24. sempy_labs/_kql_querysets.py +16 -15
  25. sempy_labs/_list_functions.py +150 -126
  26. sempy_labs/_managed_private_endpoints.py +19 -17
  27. sempy_labs/_mirrored_databases.py +51 -48
  28. sempy_labs/_mirrored_warehouses.py +5 -4
  29. sempy_labs/_ml_experiments.py +16 -15
  30. sempy_labs/_ml_models.py +15 -14
  31. sempy_labs/_model_bpa.py +210 -207
  32. sempy_labs/_model_bpa_bulk.py +2 -2
  33. sempy_labs/_model_bpa_rules.py +3 -3
  34. sempy_labs/_model_dependencies.py +55 -29
  35. sempy_labs/_notebooks.py +29 -25
  36. sempy_labs/_one_lake_integration.py +23 -26
  37. sempy_labs/_query_scale_out.py +75 -64
  38. sempy_labs/_refresh_semantic_model.py +25 -26
  39. sempy_labs/_spark.py +33 -32
  40. sempy_labs/_sql.py +19 -12
  41. sempy_labs/_translations.py +10 -7
  42. sempy_labs/_vertipaq.py +38 -33
  43. sempy_labs/_warehouses.py +26 -25
  44. sempy_labs/_workspace_identity.py +11 -10
  45. sempy_labs/_workspaces.py +40 -33
  46. sempy_labs/admin/_basic_functions.py +166 -115
  47. sempy_labs/admin/_domains.py +7 -2
  48. sempy_labs/admin/_external_data_share.py +3 -3
  49. sempy_labs/admin/_git.py +4 -1
  50. sempy_labs/admin/_items.py +11 -6
  51. sempy_labs/admin/_scanner.py +10 -5
  52. sempy_labs/directlake/_directlake_schema_compare.py +25 -16
  53. sempy_labs/directlake/_directlake_schema_sync.py +24 -12
  54. sempy_labs/directlake/_dl_helper.py +74 -55
  55. sempy_labs/directlake/_generate_shared_expression.py +10 -9
  56. sempy_labs/directlake/_get_directlake_lakehouse.py +32 -36
  57. sempy_labs/directlake/_get_shared_expression.py +4 -3
  58. sempy_labs/directlake/_guardrails.py +12 -6
  59. sempy_labs/directlake/_list_directlake_model_calc_tables.py +15 -9
  60. sempy_labs/directlake/_show_unsupported_directlake_objects.py +16 -10
  61. sempy_labs/directlake/_update_directlake_model_lakehouse_connection.py +35 -31
  62. sempy_labs/directlake/_update_directlake_partition_entity.py +39 -31
  63. sempy_labs/directlake/_warm_cache.py +87 -65
  64. sempy_labs/lakehouse/_get_lakehouse_columns.py +23 -26
  65. sempy_labs/lakehouse/_get_lakehouse_tables.py +27 -38
  66. sempy_labs/lakehouse/_lakehouse.py +7 -20
  67. sempy_labs/lakehouse/_shortcuts.py +42 -23
  68. sempy_labs/migration/_create_pqt_file.py +16 -11
  69. sempy_labs/migration/_refresh_calc_tables.py +16 -10
  70. sempy_labs/report/_download_report.py +9 -8
  71. sempy_labs/report/_generate_report.py +85 -44
  72. sempy_labs/report/_paginated.py +9 -9
  73. sempy_labs/report/_report_bpa.py +15 -11
  74. sempy_labs/report/_report_functions.py +80 -91
  75. sempy_labs/report/_report_helper.py +8 -4
  76. sempy_labs/report/_report_list_functions.py +24 -13
  77. sempy_labs/report/_report_rebind.py +17 -16
  78. sempy_labs/report/_reportwrapper.py +41 -33
  79. sempy_labs/tom/_model.py +139 -21
  80. {semantic_link_labs-0.8.10.dist-info → semantic_link_labs-0.9.0.dist-info}/LICENSE +0 -0
  81. {semantic_link_labs-0.8.10.dist-info → semantic_link_labs-0.9.0.dist-info}/top_level.txt +0 -0
@@ -6,9 +6,10 @@ from sempy_labs._helper_functions import (
6
6
  from typing import Optional
7
7
  import sempy_labs._icons as icons
8
8
  from sempy.fabric.exceptions import FabricHTTPException
9
+ from uuid import UUID
9
10
 
10
11
 
11
- def provision_workspace_identity(workspace: Optional[str] = None):
12
+ def provision_workspace_identity(workspace: Optional[str | UUID] = None):
12
13
  """
13
14
  Provisions a workspace identity for a workspace.
14
15
 
@@ -16,13 +17,13 @@ def provision_workspace_identity(workspace: Optional[str] = None):
16
17
 
17
18
  Parameters
18
19
  ----------
19
- workspace : str, default=None
20
- The Fabric workspace name.
20
+ workspace : str | uuid.UUID, default=None
21
+ The Fabric workspace name or ID.
21
22
  Defaults to None which resolves to the workspace of the attached lakehouse
22
23
  or if no lakehouse attached, resolves to the workspace of the notebook.
23
24
  """
24
25
 
25
- workspace, workspace_id = resolve_workspace_name_and_id(workspace)
26
+ (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
26
27
 
27
28
  client = fabric.FabricRestClient()
28
29
  response = client.post(f"/v1/workspaces/{workspace_id}/provisionIdentity")
@@ -33,11 +34,11 @@ def provision_workspace_identity(workspace: Optional[str] = None):
33
34
  lro(client, response)
34
35
 
35
36
  print(
36
- f"{icons.green_dot} A workspace identity has been provisioned for the '{workspace}' workspace."
37
+ f"{icons.green_dot} A workspace identity has been provisioned for the '{workspace_name}' workspace."
37
38
  )
38
39
 
39
40
 
40
- def deprovision_workspace_identity(workspace: Optional[str] = None):
41
+ def deprovision_workspace_identity(workspace: Optional[str | UUID] = None):
41
42
  """
42
43
  Deprovisions a workspace identity for a workspace.
43
44
 
@@ -45,13 +46,13 @@ def deprovision_workspace_identity(workspace: Optional[str] = None):
45
46
 
46
47
  Parameters
47
48
  ----------
48
- workspace : str, default=None
49
- The Fabric workspace name.
49
+ workspace : str | uuid.UUID, default=None
50
+ The Fabric workspace name or ID.
50
51
  Defaults to None which resolves to the workspace of the attached lakehouse
51
52
  or if no lakehouse attached, resolves to the workspace of the notebook.
52
53
  """
53
54
 
54
- workspace, workspace_id = resolve_workspace_name_and_id(workspace)
55
+ (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
55
56
 
56
57
  client = fabric.FabricRestClient()
57
58
  response = client.post(f"/v1/workspaces/{workspace_id}/deprovisionIdentity")
@@ -62,5 +63,5 @@ def deprovision_workspace_identity(workspace: Optional[str] = None):
62
63
  lro(client, response)
63
64
 
64
65
  print(
65
- f"{icons.green_dot} The workspace identity has been deprovisioned from the '{workspace}' workspace."
66
+ f"{icons.green_dot} The workspace identity has been deprovisioned from the '{workspace_name}' workspace."
66
67
  )
sempy_labs/_workspaces.py CHANGED
@@ -8,9 +8,12 @@ from sempy_labs._helper_functions import (
8
8
  resolve_capacity_id,
9
9
  )
10
10
  from sempy.fabric.exceptions import FabricHTTPException
11
+ from uuid import UUID
11
12
 
12
13
 
13
- def delete_user_from_workspace(email_address: str, workspace: Optional[str] = None):
14
+ def delete_user_from_workspace(
15
+ email_address: str, workspace: Optional[str | UUID] = None
16
+ ):
14
17
  """
15
18
  Removes a user from a workspace.
16
19
 
@@ -20,13 +23,13 @@ def delete_user_from_workspace(email_address: str, workspace: Optional[str] = No
20
23
  ----------
21
24
  email_address : str
22
25
  The email address of the user.
23
- workspace : str, default=None
24
- The name of the workspace.
26
+ workspace : str | uuid.UUID, default=None
27
+ The name or ID of the workspace.
25
28
  Defaults to None which resolves to the workspace of the attached lakehouse
26
29
  or if no lakehouse attached, resolves to the workspace of the notebook.
27
30
  """
28
31
 
29
- (workspace, workspace_id) = resolve_workspace_name_and_id(workspace)
32
+ (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
30
33
 
31
34
  client = fabric.PowerBIRestClient()
32
35
  response = client.delete(f"/v1.0/myorg/groups/{workspace_id}/users/{email_address}")
@@ -34,7 +37,7 @@ def delete_user_from_workspace(email_address: str, workspace: Optional[str] = No
34
37
  if response.status_code != 200:
35
38
  raise FabricHTTPException(response)
36
39
  print(
37
- f"{icons.green_dot} The '{email_address}' user has been removed from accessing the '{workspace}' workspace."
40
+ f"{icons.green_dot} The '{email_address}' user has been removed from accessing the '{workspace_name}' workspace."
38
41
  )
39
42
 
40
43
 
@@ -42,7 +45,7 @@ def update_workspace_user(
42
45
  email_address: str,
43
46
  role_name: str,
44
47
  principal_type: Optional[str] = "User",
45
- workspace: Optional[str] = None,
48
+ workspace: Optional[str | UUID] = None,
46
49
  ):
47
50
  """
48
51
  Updates a user's role within a workspace.
@@ -57,13 +60,13 @@ def update_workspace_user(
57
60
  The `role <https://learn.microsoft.com/rest/api/power-bi/groups/add-group-user#groupuseraccessright>`_ of the user within the workspace.
58
61
  principal_type : str, default='User'
59
62
  The `principal type <https://learn.microsoft.com/rest/api/power-bi/groups/add-group-user#principaltype>`_.
60
- workspace : str, default=None
61
- The name of the workspace.
63
+ workspace : str | uuid.UUID, default=None
64
+ The name or ID of the workspace.
62
65
  Defaults to None which resolves to the workspace of the attached lakehouse
63
66
  or if no lakehouse attached, resolves to the workspace of the notebook.
64
67
  """
65
68
 
66
- (workspace, workspace_id) = resolve_workspace_name_and_id(workspace)
69
+ (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
67
70
 
68
71
  role_names = icons.workspace_roles
69
72
  role_name = role_name.capitalize()
@@ -91,11 +94,11 @@ def update_workspace_user(
91
94
  if response.status_code != 200:
92
95
  raise FabricHTTPException(response)
93
96
  print(
94
- f"{icons.green_dot} The '{email_address}' user has been updated to a '{role_name}' within the '{workspace}' workspace."
97
+ f"{icons.green_dot} The '{email_address}' user has been updated to a '{role_name}' within the '{workspace_name}' workspace."
95
98
  )
96
99
 
97
100
 
98
- def list_workspace_users(workspace: Optional[str] = None) -> pd.DataFrame:
101
+ def list_workspace_users(workspace: Optional[str | UUID] = None) -> pd.DataFrame:
99
102
  """
100
103
  A list of all the users of a workspace and their roles.
101
104
 
@@ -103,8 +106,8 @@ def list_workspace_users(workspace: Optional[str] = None) -> pd.DataFrame:
103
106
 
104
107
  Parameters
105
108
  ----------
106
- workspace : str, default=None
107
- The name of the workspace.
109
+ workspace : str | uuid.UUID, default=None
110
+ The name or ID of the workspace.
108
111
  Defaults to None which resolves to the workspace of the attached lakehouse
109
112
  or if no lakehouse attached, resolves to the workspace of the notebook.
110
113
 
@@ -114,7 +117,7 @@ def list_workspace_users(workspace: Optional[str] = None) -> pd.DataFrame:
114
117
  A pandas dataframe the users of a workspace and their properties.
115
118
  """
116
119
 
117
- (workspace, workspace_id) = resolve_workspace_name_and_id(workspace)
120
+ (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
118
121
 
119
122
  df = pd.DataFrame(columns=["User Name", "Email Address", "Role", "Type", "User ID"])
120
123
  client = fabric.FabricRestClient()
@@ -143,7 +146,7 @@ def add_user_to_workspace(
143
146
  email_address: str,
144
147
  role_name: str,
145
148
  principal_type: Optional[str] = "User",
146
- workspace: Optional[str] = None,
149
+ workspace: Optional[str | UUID] = None,
147
150
  ):
148
151
  """
149
152
  Adds a user to a workspace.
@@ -158,13 +161,13 @@ def add_user_to_workspace(
158
161
  The `role <https://learn.microsoft.com/rest/api/power-bi/groups/add-group-user#groupuseraccessright>`_ of the user within the workspace.
159
162
  principal_type : str, default='User'
160
163
  The `principal type <https://learn.microsoft.com/rest/api/power-bi/groups/add-group-user#principaltype>`_.
161
- workspace : str, default=None
162
- The name of the workspace.
164
+ workspace : str | uuid.UUID, default=None
165
+ The name or ID of the workspace.
163
166
  Defaults to None which resolves to the workspace of the attached lakehouse
164
167
  or if no lakehouse attached, resolves to the workspace of the notebook.
165
168
  """
166
169
 
167
- (workspace, workspace_id) = resolve_workspace_name_and_id(workspace)
170
+ (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
168
171
 
169
172
  role_names = icons.workspace_roles
170
173
  role_name = role_name.capitalize()
@@ -196,11 +199,13 @@ def add_user_to_workspace(
196
199
  if response.status_code != 200:
197
200
  raise FabricHTTPException(response)
198
201
  print(
199
- f"{icons.green_dot} The '{email_address}' user has been added as a{plural} '{role_name}' within the '{workspace}' workspace."
202
+ f"{icons.green_dot} The '{email_address}' user has been added as a{plural} '{role_name}' within the '{workspace_name}' workspace."
200
203
  )
201
204
 
202
205
 
203
- def assign_workspace_to_capacity(capacity_name: str, workspace: Optional[str] = None):
206
+ def assign_workspace_to_capacity(
207
+ capacity_name: str, workspace: Optional[str | UUID] = None
208
+ ):
204
209
  """
205
210
  Assigns a workspace to a capacity.
206
211
 
@@ -210,13 +215,13 @@ def assign_workspace_to_capacity(capacity_name: str, workspace: Optional[str] =
210
215
  ----------
211
216
  capacity_name : str
212
217
  The name of the capacity.
213
- workspace : str, default=None
214
- The name of the Fabric workspace.
218
+ workspace : str | uuid.UUID, default=None
219
+ The name or ID of the Fabric workspace.
215
220
  Defaults to None which resolves to the workspace of the attached lakehouse
216
221
  or if no lakehouse attached, resolves to the workspace of the notebook.
217
222
  """
218
223
 
219
- (workspace, workspace_id) = resolve_workspace_name_and_id(workspace)
224
+ (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
220
225
  capacity_id = resolve_capacity_id(capacity_name=capacity_name)
221
226
 
222
227
  request_body = {"capacityId": capacity_id}
@@ -230,11 +235,11 @@ def assign_workspace_to_capacity(capacity_name: str, workspace: Optional[str] =
230
235
  if response.status_code not in [200, 202]:
231
236
  raise FabricHTTPException(response)
232
237
  print(
233
- f"{icons.green_dot} The '{workspace}' workspace has been assigned to the '{capacity_name}' capacity."
238
+ f"{icons.green_dot} The '{workspace_name}' workspace has been assigned to the '{capacity_name}' capacity."
234
239
  )
235
240
 
236
241
 
237
- def unassign_workspace_from_capacity(workspace: Optional[str] = None):
242
+ def unassign_workspace_from_capacity(workspace: Optional[str | UUID] = None):
238
243
  """
239
244
  Unassigns a workspace from its assigned capacity.
240
245
 
@@ -242,13 +247,13 @@ def unassign_workspace_from_capacity(workspace: Optional[str] = None):
242
247
 
243
248
  Parameters
244
249
  ----------
245
- workspace : str, default=None
246
- The name of the Fabric workspace.
250
+ workspace : str | uuid.UUID, default=None
251
+ The name or ID of the Fabric workspace.
247
252
  Defaults to None which resolves to the workspace of the attached lakehouse
248
253
  or if no lakehouse attached, resolves to the workspace of the notebook.
249
254
  """
250
255
 
251
- (workspace, workspace_id) = resolve_workspace_name_and_id(workspace)
256
+ (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
252
257
 
253
258
  client = fabric.FabricRestClient()
254
259
  response = client.post(f"/v1/workspaces/{workspace_id}/unassignFromCapacity")
@@ -256,11 +261,13 @@ def unassign_workspace_from_capacity(workspace: Optional[str] = None):
256
261
  if response.status_code not in [200, 202]:
257
262
  raise FabricHTTPException(response)
258
263
  print(
259
- f"{icons.green_dot} The '{workspace}' workspace has been unassigned from its capacity."
264
+ f"{icons.green_dot} The '{workspace_name}' workspace has been unassigned from its capacity."
260
265
  )
261
266
 
262
267
 
263
- def list_workspace_role_assignments(workspace: Optional[str] = None) -> pd.DataFrame:
268
+ def list_workspace_role_assignments(
269
+ workspace: Optional[str | UUID] = None,
270
+ ) -> pd.DataFrame:
264
271
  """
265
272
  Shows the members of a given workspace.
266
273
 
@@ -268,8 +275,8 @@ def list_workspace_role_assignments(workspace: Optional[str] = None) -> pd.DataF
268
275
 
269
276
  Parameters
270
277
  ----------
271
- workspace : str, default=None
272
- The Fabric workspace name.
278
+ workspace : str | uuid.UUID, default=None
279
+ The Fabric workspace name or ID.
273
280
  Defaults to None which resolves to the workspace of the attached lakehouse
274
281
  or if no lakehouse attached, resolves to the workspace of the notebook.
275
282
 
@@ -279,7 +286,7 @@ def list_workspace_role_assignments(workspace: Optional[str] = None) -> pd.DataF
279
286
  A pandas dataframe showing the members of a given workspace and their roles.
280
287
  """
281
288
 
282
- (workspace, workspace_id) = resolve_workspace_name_and_id(workspace)
289
+ (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
283
290
 
284
291
  df = pd.DataFrame(columns=["User Name", "User Email", "Role Name", "Type"])
285
292