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.

Files changed (73) hide show
  1. {semantic_link_labs-0.8.10.dist-info → semantic_link_labs-0.8.11.dist-info}/METADATA +3 -2
  2. {semantic_link_labs-0.8.10.dist-info → semantic_link_labs-0.8.11.dist-info}/RECORD +73 -72
  3. sempy_labs/__init__.py +6 -2
  4. sempy_labs/_clear_cache.py +39 -37
  5. sempy_labs/_connections.py +13 -13
  6. sempy_labs/_data_pipelines.py +20 -20
  7. sempy_labs/_dataflows.py +27 -28
  8. sempy_labs/_dax.py +41 -47
  9. sempy_labs/_environments.py +26 -23
  10. sempy_labs/_eventhouses.py +16 -15
  11. sempy_labs/_eventstreams.py +16 -15
  12. sempy_labs/_external_data_shares.py +18 -20
  13. sempy_labs/_gateways.py +14 -14
  14. sempy_labs/_generate_semantic_model.py +99 -62
  15. sempy_labs/_git.py +105 -43
  16. sempy_labs/_helper_functions.py +148 -131
  17. sempy_labs/_job_scheduler.py +92 -0
  18. sempy_labs/_kql_databases.py +16 -15
  19. sempy_labs/_kql_querysets.py +16 -15
  20. sempy_labs/_list_functions.py +114 -99
  21. sempy_labs/_managed_private_endpoints.py +19 -17
  22. sempy_labs/_mirrored_databases.py +51 -48
  23. sempy_labs/_mirrored_warehouses.py +5 -4
  24. sempy_labs/_ml_experiments.py +16 -15
  25. sempy_labs/_ml_models.py +15 -14
  26. sempy_labs/_model_bpa.py +3 -3
  27. sempy_labs/_model_dependencies.py +55 -29
  28. sempy_labs/_notebooks.py +27 -25
  29. sempy_labs/_one_lake_integration.py +23 -26
  30. sempy_labs/_query_scale_out.py +67 -64
  31. sempy_labs/_refresh_semantic_model.py +25 -26
  32. sempy_labs/_spark.py +33 -32
  33. sempy_labs/_sql.py +12 -9
  34. sempy_labs/_translations.py +10 -7
  35. sempy_labs/_vertipaq.py +34 -31
  36. sempy_labs/_warehouses.py +22 -21
  37. sempy_labs/_workspace_identity.py +11 -10
  38. sempy_labs/_workspaces.py +40 -33
  39. sempy_labs/admin/_basic_functions.py +10 -12
  40. sempy_labs/admin/_external_data_share.py +3 -3
  41. sempy_labs/admin/_items.py +4 -4
  42. sempy_labs/admin/_scanner.py +3 -1
  43. sempy_labs/directlake/_directlake_schema_compare.py +18 -14
  44. sempy_labs/directlake/_directlake_schema_sync.py +18 -12
  45. sempy_labs/directlake/_dl_helper.py +25 -26
  46. sempy_labs/directlake/_generate_shared_expression.py +10 -9
  47. sempy_labs/directlake/_get_directlake_lakehouse.py +16 -13
  48. sempy_labs/directlake/_get_shared_expression.py +4 -3
  49. sempy_labs/directlake/_guardrails.py +12 -6
  50. sempy_labs/directlake/_list_directlake_model_calc_tables.py +15 -9
  51. sempy_labs/directlake/_show_unsupported_directlake_objects.py +16 -10
  52. sempy_labs/directlake/_update_directlake_model_lakehouse_connection.py +35 -31
  53. sempy_labs/directlake/_update_directlake_partition_entity.py +34 -31
  54. sempy_labs/directlake/_warm_cache.py +87 -65
  55. sempy_labs/lakehouse/_get_lakehouse_columns.py +10 -8
  56. sempy_labs/lakehouse/_get_lakehouse_tables.py +10 -9
  57. sempy_labs/lakehouse/_lakehouse.py +17 -13
  58. sempy_labs/lakehouse/_shortcuts.py +42 -23
  59. sempy_labs/migration/_create_pqt_file.py +16 -11
  60. sempy_labs/migration/_refresh_calc_tables.py +16 -10
  61. sempy_labs/report/_download_report.py +9 -8
  62. sempy_labs/report/_generate_report.py +40 -44
  63. sempy_labs/report/_paginated.py +9 -9
  64. sempy_labs/report/_report_bpa.py +13 -9
  65. sempy_labs/report/_report_functions.py +80 -91
  66. sempy_labs/report/_report_helper.py +8 -4
  67. sempy_labs/report/_report_list_functions.py +24 -13
  68. sempy_labs/report/_report_rebind.py +17 -16
  69. sempy_labs/report/_reportwrapper.py +41 -33
  70. sempy_labs/tom/_model.py +43 -6
  71. {semantic_link_labs-0.8.10.dist-info → semantic_link_labs-0.8.11.dist-info}/LICENSE +0 -0
  72. {semantic_link_labs-0.8.10.dist-info → semantic_link_labs-0.8.11.dist-info}/WHEEL +0 -0
  73. {semantic_link_labs-0.8.10.dist-info → semantic_link_labs-0.8.11.dist-info}/top_level.txt +0 -0
sempy_labs/_git.py CHANGED
@@ -7,19 +7,19 @@ from sempy_labs._helper_functions import (
7
7
  lro,
8
8
  )
9
9
  from sempy.fabric.exceptions import FabricHTTPException
10
+ from uuid import UUID
10
11
 
11
12
 
12
- def connect_workspace_to_git(
13
+ def connect_workspace_to_azure_dev_ops(
13
14
  organization_name: str,
14
15
  project_name: str,
15
16
  repository_name: str,
16
17
  branch_name: str,
17
18
  directory_name: str,
18
- git_provider_type: str = "AzureDevOps",
19
- workspace: Optional[str] = None,
19
+ workspace: Optional[str | UUID] = None,
20
20
  ):
21
21
  """
22
- Connects a workspace to a git repository.
22
+ Connects a workspace to an Azure DevOps git repository.
23
23
 
24
24
  This is a wrapper function for the following API: `Git - Connect <https://learn.microsoft.com/rest/api/fabric/core/git/connect>`_.
25
25
 
@@ -35,21 +35,19 @@ def connect_workspace_to_git(
35
35
  The branch name.
36
36
  directory_name : str
37
37
  The directory name.
38
- git_provider_type : str, default="AzureDevOps"
39
- A `Git provider type <https://learn.microsoft.com/rest/api/fabric/core/git/connect?tabs=HTTP#gitprovidertype>`_.
40
- workspace : str, default=None
41
- The Fabric workspace name.
38
+ workspace : str | uuid.UUID, default=None
39
+ The Fabric workspace name or ID.
42
40
  Defaults to None which resolves to the workspace of the attached lakehouse
43
41
  or if no lakehouse attached, resolves to the workspace of the notebook.
44
42
  """
45
43
 
46
- workspace, workspace_id = resolve_workspace_name_and_id(workspace)
44
+ (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
47
45
 
48
46
  request_body = {
49
47
  "gitProviderDetails": {
50
48
  "organizationName": organization_name,
51
49
  "projectName": project_name,
52
- "gitProviderType": git_provider_type,
50
+ "gitProviderType": "AzureDevOps",
53
51
  "repositoryName": repository_name,
54
52
  "branchName": branch_name,
55
53
  "directoryName": directory_name,
@@ -64,11 +62,73 @@ def connect_workspace_to_git(
64
62
  raise FabricHTTPException(response)
65
63
 
66
64
  print(
67
- f"{icons.green_dot} The '{workspace}' workspace has been connected to the '{project_name}' Git project within the '{repository_name}' repository."
65
+ f"{icons.green_dot} The '{workspace_name}' workspace has been connected to the '{project_name}' Git project in Azure DevOps within the '{repository_name}' repository."
68
66
  )
69
67
 
70
68
 
71
- def disconnect_workspace_from_git(workspace: Optional[str] = None):
69
+ def connect_workspace_to_github(
70
+ owner_name: str,
71
+ repository_name: str,
72
+ branch_name: str,
73
+ directory_name: str,
74
+ connection_id: UUID,
75
+ source: str = "ConfiguredConnection",
76
+ workspace: Optional[str | UUID] = None,
77
+ ):
78
+ """
79
+ Connects a workspace to a GitHub git repository.
80
+
81
+ This is a wrapper function for the following API: `Git - Connect <https://learn.microsoft.com/rest/api/fabric/core/git/connect>`_.
82
+
83
+ Parameters
84
+ ----------
85
+ owner_name : str
86
+ The owner name.
87
+ repository_name : str
88
+ The repository name.
89
+ branch_name : str
90
+ The branch name.
91
+ directory_name : str
92
+ The directory name.
93
+ source : str, default="ConfiguredConnection"
94
+ The Git credentials source.
95
+ connection_id : uuid.UUID
96
+ The object ID of the connection.
97
+ workspace : str | uuid.UUID, default=None
98
+ The Fabric workspace name or ID.
99
+ Defaults to None which resolves to the workspace of the attached lakehouse
100
+ or if no lakehouse attached, resolves to the workspace of the notebook.
101
+ """
102
+
103
+ (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
104
+
105
+ request_body = {
106
+ "gitProviderDetails": {
107
+ "ownerName": owner_name,
108
+ "gitProviderType": "GitHub",
109
+ "repositoryName": repository_name,
110
+ "branchName": branch_name,
111
+ "directoryName": directory_name,
112
+ },
113
+ "myGitCredentials": {
114
+ "source": source,
115
+ "connectionId": connection_id,
116
+ },
117
+ }
118
+
119
+ client = fabric.FabricRestClient()
120
+ response = client.post(
121
+ f"/v1/workspaces/{workspace_id}/git/connect", json=request_body
122
+ )
123
+ if response.status_code != 200:
124
+ raise FabricHTTPException(response)
125
+
126
+ print(
127
+ f"{icons.green_dot} The '{workspace_name}' workspace has been connected to the '{repository_name}' GitHub repository."
128
+ )
129
+
130
+
131
+ def disconnect_workspace_from_git(workspace: Optional[str | UUID] = None):
72
132
  """
73
133
  Disconnects a workpsace from a git repository.
74
134
 
@@ -76,13 +136,13 @@ def disconnect_workspace_from_git(workspace: Optional[str] = None):
76
136
 
77
137
  Parameters
78
138
  ----------
79
- workspace : str, default=None
80
- The Fabric workspace name.
139
+ workspace : str | uuid.UUID, default=None
140
+ The Fabric workspace name or ID.
81
141
  Defaults to None which resolves to the workspace of the attached lakehouse
82
142
  or if no lakehouse attached, resolves to the workspace of the notebook.
83
143
  """
84
144
 
85
- workspace, workspace_id = resolve_workspace_name_and_id(workspace)
145
+ (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
86
146
 
87
147
  client = fabric.FabricRestClient()
88
148
  response = client.post(f"/v1/workspaces/{workspace_id}/git/disconnect")
@@ -90,11 +150,11 @@ def disconnect_workspace_from_git(workspace: Optional[str] = None):
90
150
  raise FabricHTTPException(response)
91
151
 
92
152
  print(
93
- f"{icons.green_dot} The '{workspace}' workspace has been disconnected from Git."
153
+ f"{icons.green_dot} The '{workspace_name}' workspace has been disconnected from Git."
94
154
  )
95
155
 
96
156
 
97
- def get_git_status(workspace: Optional[str] = None) -> pd.DataFrame:
157
+ def get_git_status(workspace: Optional[str | UUID] = None) -> pd.DataFrame:
98
158
  """
99
159
  Obtains the Git status of items in the workspace, that can be committed to Git.
100
160
 
@@ -102,8 +162,8 @@ def get_git_status(workspace: Optional[str] = None) -> pd.DataFrame:
102
162
 
103
163
  Parameters
104
164
  ----------
105
- workspace : str, default=None
106
- The Fabric workspace name.
165
+ workspace : str | uuid.UUID, default=None
166
+ The Fabric workspace name or ID.
107
167
  Defaults to None which resolves to the workspace of the attached lakehouse
108
168
  or if no lakehouse attached, resolves to the workspace of the notebook.
109
169
 
@@ -113,7 +173,7 @@ def get_git_status(workspace: Optional[str] = None) -> pd.DataFrame:
113
173
  A pandas dataframe showing the Git status of items in the workspace.
114
174
  """
115
175
 
116
- workspace, workspace_id = resolve_workspace_name_and_id(workspace)
176
+ (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
117
177
 
118
178
  df = pd.DataFrame(
119
179
  columns=[
@@ -157,7 +217,7 @@ def get_git_status(workspace: Optional[str] = None) -> pd.DataFrame:
157
217
  return df
158
218
 
159
219
 
160
- def get_git_connection(workspace: Optional[str] = None) -> pd.DataFrame:
220
+ def get_git_connection(workspace: Optional[str | UUID] = None) -> pd.DataFrame:
161
221
  """
162
222
  Obtains the Git status of items in the workspace, that can be committed to Git.
163
223
 
@@ -165,8 +225,8 @@ def get_git_connection(workspace: Optional[str] = None) -> pd.DataFrame:
165
225
 
166
226
  Parameters
167
227
  ----------
168
- workspace : str, default=None
169
- The Fabric workspace name.
228
+ workspace : str | uuid.UUID, default=None
229
+ The Fabric workspace name or ID.
170
230
  Defaults to None which resolves to the workspace of the attached lakehouse
171
231
  or if no lakehouse attached, resolves to the workspace of the notebook.
172
232
 
@@ -176,7 +236,7 @@ def get_git_connection(workspace: Optional[str] = None) -> pd.DataFrame:
176
236
  A pandas dataframe showing the Git status of items in the workspace.
177
237
  """
178
238
 
179
- workspace, workspace_id = resolve_workspace_name_and_id(workspace)
239
+ (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
180
240
 
181
241
  df = pd.DataFrame(
182
242
  columns=[
@@ -217,7 +277,7 @@ def get_git_connection(workspace: Optional[str] = None) -> pd.DataFrame:
217
277
  return df
218
278
 
219
279
 
220
- def initialize_git_connection(workspace: Optional[str] = None) -> str:
280
+ def initialize_git_connection(workspace: Optional[str | UUID] = None) -> str:
221
281
  """
222
282
  Initializes a connection for a workspace that is connected to Git.
223
283
 
@@ -225,8 +285,8 @@ def initialize_git_connection(workspace: Optional[str] = None) -> str:
225
285
 
226
286
  Parameters
227
287
  ----------
228
- workspace : str, default=None
229
- The Fabric workspace name.
288
+ workspace : str | uuid.UUID, default=None
289
+ The Fabric workspace name or ID.
230
290
  Defaults to None which resolves to the workspace of the attached lakehouse
231
291
  or if no lakehouse attached, resolves to the workspace of the notebook.
232
292
 
@@ -236,7 +296,7 @@ def initialize_git_connection(workspace: Optional[str] = None) -> str:
236
296
  Remote full SHA commit hash.
237
297
  """
238
298
 
239
- workspace, workspace_id = resolve_workspace_name_and_id(workspace)
299
+ (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
240
300
 
241
301
  client = fabric.FabricRestClient()
242
302
  response = client.post(f"/v1/workspaces/{workspace_id}/git/initializeConnection")
@@ -247,14 +307,16 @@ def initialize_git_connection(workspace: Optional[str] = None) -> str:
247
307
  lro(client, response)
248
308
 
249
309
  print(
250
- f"{icons.green_dot} The '{workspace}' workspace git connection has been initialized."
310
+ f"{icons.green_dot} The '{workspace_name}' workspace git connection has been initialized."
251
311
  )
252
312
 
253
313
  return response.json().get("remoteCommitHash")
254
314
 
255
315
 
256
316
  def commit_to_git(
257
- comment: str, item_ids: str | List[str] = None, workspace: Optional[str] = None
317
+ comment: str,
318
+ item_ids: UUID | List[UUID] = None,
319
+ workspace: Optional[str | UUID] = None,
258
320
  ):
259
321
  """
260
322
  Commits all or a selection of items within a workspace to Git.
@@ -265,18 +327,18 @@ def commit_to_git(
265
327
  ----------
266
328
  comment : str
267
329
  The Git commit comment.
268
- item_ids : str | List[str], default=None
330
+ item_ids : uuid.UUID | List[uuid.UUID], default=None
269
331
  A list of item Ids to commit to Git.
270
332
  Defaults to None which commits all items to Git.
271
- workspace : str, default=None
272
- The Fabric workspace name.
333
+ workspace : str | uuid.UUID, default=None
334
+ The Fabric workspace name or ID.
273
335
  Defaults to None which resolves to the workspace of the attached lakehouse
274
336
  or if no lakehouse attached, resolves to the workspace of the notebook.
275
337
  """
276
338
 
277
- workspace, workspace_id = resolve_workspace_name_and_id(workspace)
339
+ (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
278
340
 
279
- gs = get_git_status(workspace=workspace)
341
+ gs = get_git_status(workspace=workspace_id)
280
342
  if not gs.empty:
281
343
  workspace_head = gs["Workspace Head"].iloc[0]
282
344
 
@@ -310,15 +372,15 @@ def commit_to_git(
310
372
 
311
373
  if commit_mode == "All":
312
374
  print(
313
- f"{icons.green_dot} All items within the '{workspace}' workspace have been committed to Git."
375
+ f"{icons.green_dot} All items within the '{workspace_name}' workspace have been committed to Git."
314
376
  )
315
377
  else:
316
378
  print(
317
- f"{icons.green_dot} The {item_ids} items within the '{workspace}' workspace have been committed to Git."
379
+ f"{icons.green_dot} The {item_ids} items within the '{workspace_name}' workspace have been committed to Git."
318
380
  )
319
381
  else:
320
382
  print(
321
- f"{icons.info} Git already up to date: no modified items found within the '{workspace}' workspace."
383
+ f"{icons.info} Git already up to date: no modified items found within the '{workspace_name}' workspace."
322
384
  )
323
385
 
324
386
 
@@ -327,7 +389,7 @@ def update_from_git(
327
389
  conflict_resolution_policy: str,
328
390
  workspace_head: Optional[str] = None,
329
391
  allow_override: bool = False,
330
- workspace: Optional[str] = None,
392
+ workspace: Optional[str | UUID] = None,
331
393
  ):
332
394
  """
333
395
  Updates the workspace with commits pushed to the connected branch.
@@ -345,13 +407,13 @@ def update_from_git(
345
407
  In other cases, the system will validate that the given value is aligned with the head known to the system.
346
408
  allow_override : bool, default=False
347
409
  User consent to override incoming items during the update from Git process. When incoming items are present and the allow override items is not specified or is provided as false, the update operation will not start. Default value is false.
348
- workspace : str, default=None
349
- The Fabric workspace name.
410
+ workspace : str | uuid.UUID, default=None
411
+ The Fabric workspace name or ID.
350
412
  Defaults to None which resolves to the workspace of the attached lakehouse
351
413
  or if no lakehouse attached, resolves to the workspace of the notebook.
352
414
  """
353
415
 
354
- workspace, workspace_id = resolve_workspace_name_and_id(workspace)
416
+ (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
355
417
 
356
418
  conflict_resolution_policies = ["PreferWorkspace", "PreferRemote"]
357
419
  if "remote" in [policy.lower() for policy in conflict_resolution_policies]:
@@ -388,5 +450,5 @@ def update_from_git(
388
450
  lro(client, response, return_status_code=True)
389
451
 
390
452
  print(
391
- f"{icons.green_dot} The '{workspace}' workspace has been updated with commits pushed to the connected branch."
453
+ f"{icons.green_dot} The '{workspace_name}' workspace has been updated with commits pushed to the connected branch."
392
454
  )