semantic-link-labs 0.8.4__py3-none-any.whl → 0.8.6__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 (49) hide show
  1. {semantic_link_labs-0.8.4.dist-info → semantic_link_labs-0.8.6.dist-info}/METADATA +9 -3
  2. {semantic_link_labs-0.8.4.dist-info → semantic_link_labs-0.8.6.dist-info}/RECORD +49 -47
  3. {semantic_link_labs-0.8.4.dist-info → semantic_link_labs-0.8.6.dist-info}/WHEEL +1 -1
  4. sempy_labs/__init__.py +29 -1
  5. sempy_labs/_data_pipelines.py +3 -3
  6. sempy_labs/_dataflows.py +116 -3
  7. sempy_labs/_dax.py +189 -3
  8. sempy_labs/_deployment_pipelines.py +3 -3
  9. sempy_labs/_environments.py +3 -3
  10. sempy_labs/_eventhouses.py +3 -3
  11. sempy_labs/_eventstreams.py +3 -3
  12. sempy_labs/_external_data_shares.py +1 -1
  13. sempy_labs/_generate_semantic_model.py +3 -3
  14. sempy_labs/_git.py +7 -7
  15. sempy_labs/_helper_functions.py +25 -1
  16. sempy_labs/_kql_databases.py +3 -3
  17. sempy_labs/_kql_querysets.py +3 -3
  18. sempy_labs/_mirrored_databases.py +428 -0
  19. sempy_labs/_mirrored_warehouses.py +1 -1
  20. sempy_labs/_ml_experiments.py +3 -3
  21. sempy_labs/_ml_models.py +4 -4
  22. sempy_labs/_model_bpa.py +209 -180
  23. sempy_labs/_model_bpa_bulk.py +48 -24
  24. sempy_labs/_model_dependencies.py +42 -86
  25. sempy_labs/_notebooks.py +2 -2
  26. sempy_labs/_query_scale_out.py +4 -4
  27. sempy_labs/_refresh_semantic_model.py +2 -2
  28. sempy_labs/_spark.py +6 -6
  29. sempy_labs/_vertipaq.py +31 -19
  30. sempy_labs/_warehouses.py +3 -3
  31. sempy_labs/_workspace_identity.py +2 -2
  32. sempy_labs/_workspaces.py +7 -7
  33. sempy_labs/admin/__init__.py +2 -0
  34. sempy_labs/admin/_basic_functions.py +54 -8
  35. sempy_labs/admin/_domains.py +1 -1
  36. sempy_labs/directlake/_update_directlake_partition_entity.py +1 -1
  37. sempy_labs/directlake/_warm_cache.py +10 -9
  38. sempy_labs/lakehouse/_get_lakehouse_tables.py +1 -1
  39. sempy_labs/lakehouse/_shortcuts.py +2 -2
  40. sempy_labs/migration/_create_pqt_file.py +9 -4
  41. sempy_labs/report/__init__.py +2 -0
  42. sempy_labs/report/_download_report.py +75 -0
  43. sempy_labs/report/_generate_report.py +3 -3
  44. sempy_labs/report/_report_functions.py +3 -3
  45. sempy_labs/report/_report_rebind.py +1 -1
  46. sempy_labs/report/_reportwrapper.py +4 -2
  47. sempy_labs/tom/_model.py +71 -35
  48. {semantic_link_labs-0.8.4.dist-info → semantic_link_labs-0.8.6.dist-info}/LICENSE +0 -0
  49. {semantic_link_labs-0.8.4.dist-info → semantic_link_labs-0.8.6.dist-info}/top_level.txt +0 -0
@@ -160,28 +160,26 @@ def get_model_calc_dependencies(
160
160
  """
161
161
 
162
162
  workspace = fabric.resolve_workspace_name(workspace)
163
-
164
163
  dep = fabric.evaluate_dax(
165
164
  dataset=dataset,
166
165
  workspace=workspace,
167
166
  dax_string="""
168
167
  SELECT
169
- [TABLE] AS [Table Name]
170
- ,[OBJECT] AS [Object Name]
171
- ,[OBJECT_TYPE] AS [Object Type]
172
- ,[EXPRESSION] AS [Expression]
173
- ,[REFERENCED_TABLE] AS [Referenced Table]
174
- ,[REFERENCED_OBJECT] AS [Referenced Object]
175
- ,[REFERENCED_OBJECT_TYPE] AS [Referenced Object Type]
168
+ [TABLE] AS [Table Name],
169
+ [OBJECT] AS [Object Name],
170
+ [OBJECT_TYPE] AS [Object Type],
171
+ [EXPRESSION] AS [Expression],
172
+ [REFERENCED_TABLE] AS [Referenced Table],
173
+ [REFERENCED_OBJECT] AS [Referenced Object],
174
+ [REFERENCED_OBJECT_TYPE] AS [Referenced Object Type]
176
175
  FROM $SYSTEM.DISCOVER_CALC_DEPENDENCY
177
176
  """,
178
177
  )
179
-
178
+ # Format data columns
180
179
  dep["Object Type"] = dep["Object Type"].str.replace("_", " ").str.title()
181
180
  dep["Referenced Object Type"] = (
182
181
  dep["Referenced Object Type"].str.replace("_", " ").str.title()
183
182
  )
184
-
185
183
  dep["Full Object Name"] = format_dax_object_name(
186
184
  dep["Table Name"], dep["Object Name"]
187
185
  )
@@ -189,83 +187,41 @@ def get_model_calc_dependencies(
189
187
  dep["Referenced Table"], dep["Referenced Object"]
190
188
  )
191
189
  dep["Parent Node"] = dep["Object Name"]
192
-
193
- df = dep
194
-
195
- objs = ["Measure", "Calc Column", "Calculation Item", "Calc Table"]
196
-
197
- df["Done"] = df.apply(
198
- lambda row: False if row["Referenced Object Type"] in objs else True, axis=1
190
+ # Initialize dependency DataFrame with 'Done' status
191
+ df = dep.copy()
192
+ objs = {"Measure", "Calc Column", "Calculation Item", "Calc Table"}
193
+ df["Done"] = (
194
+ df["Referenced Object Type"].apply(lambda x: x not in objs).astype(bool)
199
195
  )
200
-
201
- while any(df["Done"] == False):
202
- for i, r in df.iterrows():
203
- rObjFull = r["Referenced Full Object Name"]
204
- rObj = r["Referenced Object"]
205
- if r["Done"] == False:
206
- dep_filt = dep[dep["Full Object Name"] == rObjFull]
207
-
208
- for index, dependency in dep_filt.iterrows():
209
- d = True
210
- if dependency.iloc[5] in objs:
211
- d = False
212
- df = pd.concat(
213
- [
214
- df,
215
- pd.DataFrame(
216
- [
217
- {
218
- "Table Name": r["Table Name"],
219
- "Object Name": r["Object Name"],
220
- "Object Type": r["Object Type"],
221
- "Referenced Object": dependency.iloc[4],
222
- "Referenced Table": dependency.iloc[3],
223
- "Referenced Object Type": dependency.iloc[
224
- 5
225
- ],
226
- "Done": d,
227
- "Full Object Name": r["Full Object Name"],
228
- "Referenced Full Object Name": dependency.iloc[
229
- 7
230
- ],
231
- "Parent Node": rObj,
232
- }
233
- ]
234
- ),
235
- ],
236
- ignore_index=True,
237
- )
238
- else:
239
- df = pd.concat(
240
- [
241
- df,
242
- pd.DataFrame(
243
- [
244
- {
245
- "Table Name": r["Table Name"],
246
- "Object Name": r["Object Name"],
247
- "Object Type": r["Object Type"],
248
- "Referenced Object": dependency.iloc[5],
249
- "Referenced Table": dependency.iloc[4],
250
- "Referenced Object Type": dependency.iloc[
251
- 6
252
- ],
253
- "Done": d,
254
- "Full Object Name": r["Full Object Name"],
255
- "Referenced Full Object Name": dependency.iloc[
256
- 7
257
- ],
258
- "Parent Node": rObj,
259
- }
260
- ]
261
- ),
262
- ],
263
- ignore_index=True,
264
- )
265
-
266
- df.loc[i, "Done"] = True
267
-
268
- df = df.drop(["Done"], axis=1)
196
+ # Expand dependencies iteratively
197
+ while not df["Done"].all():
198
+ incomplete_rows = df[df["Done"] == False]
199
+ for _, row in incomplete_rows.iterrows():
200
+ referenced_full_name = row["Referenced Full Object Name"]
201
+ dep_filt = dep[dep["Full Object Name"] == referenced_full_name]
202
+ # Expand dependencies and update 'Done' status as needed
203
+ new_rows = []
204
+ for _, dependency in dep_filt.iterrows():
205
+ is_done = dependency["Referenced Object Type"] not in objs
206
+ new_row = {
207
+ "Table Name": row["Table Name"],
208
+ "Object Name": row["Object Name"],
209
+ "Object Type": row["Object Type"],
210
+ "Referenced Table": dependency["Referenced Table"],
211
+ "Referenced Object": dependency["Referenced Object"],
212
+ "Referenced Object Type": dependency["Referenced Object Type"],
213
+ "Done": is_done,
214
+ "Full Object Name": row["Full Object Name"],
215
+ "Referenced Full Object Name": dependency[
216
+ "Referenced Full Object Name"
217
+ ],
218
+ "Parent Node": row["Referenced Object"],
219
+ }
220
+ new_rows.append(new_row)
221
+ df = pd.concat([df, pd.DataFrame(new_rows)], ignore_index=True)
222
+ df.loc[df.index == row.name, "Done"] = True
223
+ # Finalize DataFrame and yield result
224
+ df = df.drop(columns=["Done"])
269
225
 
270
226
  return df
271
227
 
sempy_labs/_notebooks.py CHANGED
@@ -18,7 +18,7 @@ def get_notebook_definition(
18
18
  """
19
19
  Obtains the notebook definition.
20
20
 
21
- This is a wrapper function for the following API: `Items - Get Notebook Definition <https://learn.microsoft.com/rest/api/fabric/notebook/items/get-notebook-definition`_.
21
+ This is a wrapper function for the following API: `Items - Get Notebook Definition <https://learn.microsoft.com/rest/api/fabric/notebook/items/get-notebook-definition>`_.
22
22
 
23
23
  Parameters
24
24
  ----------
@@ -186,7 +186,7 @@ def update_notebook_definition(
186
186
  Parameters
187
187
  ----------
188
188
  name : str
189
- The name of the notebook to be created.
189
+ The name of the notebook to be updated.
190
190
  notebook_content : str
191
191
  The Jupyter notebook content (not in Base64 format).
192
192
  workspace : str, default=None
@@ -13,7 +13,7 @@ def qso_sync(dataset: str, workspace: Optional[str] = None):
13
13
  """
14
14
  Triggers a query scale-out sync of read-only replicas for the specified dataset from the specified workspace.
15
15
 
16
- This is a wrapper function for the following API: `Datasets - Trigger Query Scale Out Sync In Group <https://learn.microsoft.com/rest/api/power-bi/datasets/trigger-query-scale-out-sync-in-group`_.
16
+ This is a wrapper function for the following API: `Datasets - Trigger Query Scale Out Sync In Group <https://learn.microsoft.com/rest/api/power-bi/datasets/trigger-query-scale-out-sync-in-group>`_.
17
17
 
18
18
  Parameters
19
19
  ----------
@@ -46,7 +46,7 @@ def qso_sync_status(
46
46
  """
47
47
  Returns the query scale-out sync status for the specified dataset from the specified workspace.
48
48
 
49
- This is a wrapper function for the following API: `Datasets - Get Query Scale Out Sync Status In Group <https://learn.microsoft.com/rest/api/power-bi/datasets/get-query-scale-out-sync-status-in-group`_.
49
+ This is a wrapper function for the following API: `Datasets - Get Query Scale Out Sync Status In Group <https://learn.microsoft.com/rest/api/power-bi/datasets/get-query-scale-out-sync-status-in-group>`_.
50
50
 
51
51
  Parameters
52
52
  ----------
@@ -143,7 +143,7 @@ def disable_qso(dataset: str, workspace: Optional[str] = None) -> pd.DataFrame:
143
143
  """
144
144
  Sets the max read-only replicas to 0, disabling query scale out.
145
145
 
146
- This is a wrapper function for the following API: `Datasets - Update Dataset In Group <https://learn.microsoft.com/rest/api/power-bi/datasets/update-dataset-in-group`_.
146
+ This is a wrapper function for the following API: `Datasets - Update Dataset In Group <https://learn.microsoft.com/rest/api/power-bi/datasets/update-dataset-in-group>`_.
147
147
 
148
148
  Parameters
149
149
  ----------
@@ -190,7 +190,7 @@ def set_qso(
190
190
  """
191
191
  Sets the query scale out settings for a semantic model.
192
192
 
193
- This is a wrapper function for the following API: `Datasets - Update Dataset In Group <https://learn.microsoft.com/rest/api/power-bi/datasets/update-dataset-in-group`_.
193
+ This is a wrapper function for the following API: `Datasets - Update Dataset In Group <https://learn.microsoft.com/rest/api/power-bi/datasets/update-dataset-in-group>`_.
194
194
 
195
195
  Parameters
196
196
  ----------
@@ -226,7 +226,7 @@ def refresh_semantic_model(
226
226
  )
227
227
 
228
228
  print(
229
- f"{icons.green_dot} Refresh of the '{dataset}' semantic model within the '{workspace}' workspace is complete."
229
+ f"{icons.green_dot} Refresh '{refresh_type}' of the '{dataset}' semantic model within the '{workspace}' workspace is complete."
230
230
  )
231
231
  return final_df
232
232
 
@@ -247,7 +247,7 @@ def refresh_semantic_model(
247
247
  time.sleep(3)
248
248
 
249
249
  print(
250
- f"{icons.green_dot} Refresh of the '{dataset}' semantic model within the '{workspace}' workspace is complete."
250
+ f"{icons.green_dot} Refresh '{refresh_type}' of the '{dataset}' semantic model within the '{workspace}' workspace is complete."
251
251
  )
252
252
 
253
253
  final_output = refresh_and_trace_dataset(
sempy_labs/_spark.py CHANGED
@@ -12,7 +12,7 @@ def list_custom_pools(workspace: Optional[str] = None) -> pd.DataFrame:
12
12
  """
13
13
  Lists all `custom pools <https://learn.microsoft.com/fabric/data-engineering/create-custom-spark-pools>`_ within a workspace.
14
14
 
15
- This is a wrapper function for the following API: `Custom Pools - List Workspace Custom Pools <https://learn.microsoft.com/rest/api/fabric/spark/custom-pools/list-workspace-custom-pools`_.
15
+ This is a wrapper function for the following API: `Custom Pools - List Workspace Custom Pools <https://learn.microsoft.com/rest/api/fabric/spark/custom-pools/list-workspace-custom-pools>`_.
16
16
 
17
17
  Parameters
18
18
  ----------
@@ -100,7 +100,7 @@ def create_custom_pool(
100
100
  """
101
101
  Creates a `custom pool <https://learn.microsoft.com/fabric/data-engineering/create-custom-spark-pools>`_ within a workspace.
102
102
 
103
- This is a wrapper function for the following API: `Custom Pools - Create Workspace Custom Pool <https://learn.microsoft.com/rest/api/fabric/spark/custom-pools/create-workspace-custom-pool`_.
103
+ This is a wrapper function for the following API: `Custom Pools - Create Workspace Custom Pool <https://learn.microsoft.com/rest/api/fabric/spark/custom-pools/create-workspace-custom-pool>`_.
104
104
 
105
105
  Parameters
106
106
  ----------
@@ -173,7 +173,7 @@ def update_custom_pool(
173
173
  """
174
174
  Updates the properties of a `custom pool <https://learn.microsoft.com/fabric/data-engineering/create-custom-spark-pools>`_ within a workspace.
175
175
 
176
- This is a wrapper function for the following API: `Custom Pools - Update Workspace Custom Pool <https://learn.microsoft.com/rest/api/fabric/spark/custom-pools/update-workspace-custom-pool`_.
176
+ This is a wrapper function for the following API: `Custom Pools - Update Workspace Custom Pool <https://learn.microsoft.com/rest/api/fabric/spark/custom-pools/update-workspace-custom-pool>`_.
177
177
 
178
178
  Parameters
179
179
  ----------
@@ -270,7 +270,7 @@ def delete_custom_pool(pool_name: str, workspace: Optional[str] = None):
270
270
  """
271
271
  Deletes a `custom pool <https://learn.microsoft.com/fabric/data-engineering/create-custom-spark-pools>`_ within a workspace.
272
272
 
273
- This is a wrapper function for the following API: `Custom Pools - Delete Workspace Custom Pool <https://learn.microsoft.com/rest/api/fabric/spark/custom-pools/delete-workspace-custom-pool`_.
273
+ This is a wrapper function for the following API: `Custom Pools - Delete Workspace Custom Pool <https://learn.microsoft.com/rest/api/fabric/spark/custom-pools/delete-workspace-custom-pool>`_.
274
274
 
275
275
  Parameters
276
276
  ----------
@@ -309,7 +309,7 @@ def get_spark_settings(
309
309
  """
310
310
  Shows the spark settings for a workspace.
311
311
 
312
- This is a wrapper function for the following API: `Workspace Settings - Get Spark Settings <https://learn.microsoft.com/rest/api/fabric/spark/workspace-settings/get-spark-settings`_.
312
+ This is a wrapper function for the following API: `Workspace Settings - Get Spark Settings <https://learn.microsoft.com/rest/api/fabric/spark/workspace-settings/get-spark-settings>`_.
313
313
 
314
314
  Parameters
315
315
  ----------
@@ -398,7 +398,7 @@ def update_spark_settings(
398
398
  """
399
399
  Updates the spark settings for a workspace.
400
400
 
401
- This is a wrapper function for the following API: `Workspace Settings - Update Spark Settings <https://learn.microsoft.com/rest/api/fabric/spark/workspace-settings/update-spark-settings`_.
401
+ This is a wrapper function for the following API: `Workspace Settings - Update Spark Settings <https://learn.microsoft.com/rest/api/fabric/spark/workspace-settings/update-spark-settings>`_.
402
402
 
403
403
  Parameters
404
404
  ----------
sempy_labs/_vertipaq.py CHANGED
@@ -21,6 +21,7 @@ from sempy_labs.directlake import get_direct_lake_source
21
21
  from typing import Optional
22
22
  from sempy._utils._log import log
23
23
  import sempy_labs._icons as icons
24
+ from pathlib import Path
24
25
 
25
26
 
26
27
  @log
@@ -133,7 +134,22 @@ def vertipaq_analyzer(
133
134
  },
134
135
  }
135
136
 
137
+ with connect_semantic_model(
138
+ dataset=dataset, workspace=workspace, readonly=True
139
+ ) as tom:
140
+ compat_level = tom.model.Model.Database.CompatibilityLevel
141
+ is_direct_lake = tom.is_direct_lake()
142
+ def_mode = tom.model.DefaultMode
143
+ table_count = tom.model.Tables.Count
144
+ column_count = len(list(tom.all_columns()))
145
+ if table_count == 0:
146
+ print(
147
+ f"{icons.warning} The '{dataset}' semantic model within the '{workspace}' workspace has no tables. Vertipaq Analyzer can only be run if the semantic model has tables."
148
+ )
149
+ return
150
+
136
151
  dfT = list_tables(dataset=dataset, extended=True, workspace=workspace)
152
+
137
153
  dfT.rename(columns={"Name": "Table Name"}, inplace=True)
138
154
  columns_to_keep = list(vertipaq_map["Tables"].keys())
139
155
  dfT = dfT[dfT.columns.intersection(columns_to_keep)]
@@ -148,15 +164,6 @@ def vertipaq_analyzer(
148
164
  get_direct_lake_source(dataset=dataset, workspace=workspace)
149
165
  )
150
166
 
151
- with connect_semantic_model(
152
- dataset=dataset, workspace=workspace, readonly=True
153
- ) as tom:
154
- compat_level = tom.model.Model.Database.CompatibilityLevel
155
- is_direct_lake = tom.is_direct_lake()
156
- def_mode = tom.model.DefaultMode
157
- table_count = tom.model.Tables.Count
158
- column_count = len(list(tom.all_columns()))
159
-
160
167
  dfR["Missing Rows"] = 0
161
168
  dfR["Missing Rows"] = dfR["Missing Rows"].astype(int)
162
169
 
@@ -394,6 +401,8 @@ def vertipaq_analyzer(
394
401
  y = db_total_size / (1024**2) * 1000000
395
402
  elif db_total_size >= 1000:
396
403
  y = db_total_size / (1024) * 1000
404
+ else:
405
+ y = db_total_size
397
406
  y = round(y)
398
407
 
399
408
  dfModel = pd.DataFrame(
@@ -412,18 +421,19 @@ def vertipaq_analyzer(
412
421
  export_Model = dfModel.copy()
413
422
 
414
423
  def _style_columns_based_on_types(dataframe: pd.DataFrame, column_type_mapping):
415
-
416
- format_mapping = {
417
- "int": "{:,}",
418
- "pct": "{:.2f}%",
419
- "": "{}",
424
+ # Define formatting functions based on the type mappings
425
+ format_funcs = {
426
+ "int": lambda x: "{:,}".format(x) if pd.notnull(x) else "",
427
+ "pct": lambda x: "{:.2f}%".format(x) if pd.notnull(x) else "",
428
+ "": lambda x: "{}".format(x),
420
429
  }
421
430
 
422
- format_dict = {
423
- col: format_mapping[dt] for col, dt in column_type_mapping.items()
424
- }
431
+ # Apply the formatting function to each column based on its specified type
432
+ for col, dt in column_type_mapping.items():
433
+ if dt in format_funcs:
434
+ dataframe[col] = dataframe[col].map(format_funcs[dt])
425
435
 
426
- return dataframe.style.format(format_dict)
436
+ return dataframe
427
437
 
428
438
  dfModel = _style_columns_based_on_types(
429
439
  dfModel,
@@ -979,7 +989,9 @@ def import_vertipaq_analyzer(folder_path: str, file_name: str):
979
989
  dfs = {}
980
990
  for file_name in zip_ref.namelist():
981
991
  df = pd.read_csv(extracted_dir + "/" + file_name)
982
- dfs[file_name] = df
992
+ file_path = Path(file_name)
993
+ df_name = file_path.stem
994
+ dfs[df_name] = df
983
995
 
984
996
  visualize_vertipaq(dfs)
985
997
 
sempy_labs/_warehouses.py CHANGED
@@ -19,7 +19,7 @@ def create_warehouse(
19
19
  """
20
20
  Creates a Fabric warehouse.
21
21
 
22
- This is a wrapper function for the following API: `Items - Create Warehouse <https://learn.microsoft.com/rest/api/fabric/warehouse/items/create-warehouse`_.
22
+ This is a wrapper function for the following API: `Items - Create Warehouse <https://learn.microsoft.com/rest/api/fabric/warehouse/items/create-warehouse>`_.
23
23
 
24
24
  Parameters
25
25
  ----------
@@ -63,7 +63,7 @@ def list_warehouses(workspace: Optional[str] = None) -> pd.DataFrame:
63
63
  """
64
64
  Shows the warehouses within a workspace.
65
65
 
66
- This is a wrapper function for the following API: `Items - List Warehouses <https://learn.microsoft.com/rest/api/fabric/warehouse/items/list-warehouses`_.
66
+ This is a wrapper function for the following API: `Items - List Warehouses <https://learn.microsoft.com/rest/api/fabric/warehouse/items/list-warehouses>`_.
67
67
 
68
68
  Parameters
69
69
  ----------
@@ -119,7 +119,7 @@ def delete_warehouse(name: str, workspace: Optional[str] = None):
119
119
  """
120
120
  Deletes a Fabric warehouse.
121
121
 
122
- This is a wrapper function for the following API: `Items - Delete Warehouse <https://learn.microsoft.com/rest/api/fabric/warehouse/items/delete-warehouse`_.
122
+ This is a wrapper function for the following API: `Items - Delete Warehouse <https://learn.microsoft.com/rest/api/fabric/warehouse/items/delete-warehouse>`_.
123
123
 
124
124
  Parameters
125
125
  ----------
@@ -12,7 +12,7 @@ def provision_workspace_identity(workspace: Optional[str] = None):
12
12
  """
13
13
  Provisions a workspace identity for a workspace.
14
14
 
15
- This is a wrapper function for the following API: `Workspaces - Provision Identity <https://learn.microsoft.com/rest/api/fabric/core/workspaces/provision-identity`_.
15
+ This is a wrapper function for the following API: `Workspaces - Provision Identity <https://learn.microsoft.com/rest/api/fabric/core/workspaces/provision-identity>`_.
16
16
 
17
17
  Parameters
18
18
  ----------
@@ -41,7 +41,7 @@ def deprovision_workspace_identity(workspace: Optional[str] = None):
41
41
  """
42
42
  Deprovisions a workspace identity for a workspace.
43
43
 
44
- This is a wrapper function for the following API: `Workspaces - Derovision Identity <https://learn.microsoft.com/rest/api/fabric/core/workspaces/deprovision-identity`_.
44
+ This is a wrapper function for the following API: `Workspaces - Derovision Identity <https://learn.microsoft.com/rest/api/fabric/core/workspaces/deprovision-identity>`_.
45
45
 
46
46
  Parameters
47
47
  ----------
sempy_labs/_workspaces.py CHANGED
@@ -14,7 +14,7 @@ def delete_user_from_workspace(email_address: str, workspace: Optional[str] = No
14
14
  """
15
15
  Removes a user from a workspace.
16
16
 
17
- This is a wrapper function for the following API: `Groups - Delete User In Group <https://learn.microsoft.com/rest/api/power-bi/groups/delete-user-in-group`_.
17
+ This is a wrapper function for the following API: `Groups - Delete User In Group <https://learn.microsoft.com/rest/api/power-bi/groups/delete-user-in-group>`_.
18
18
 
19
19
  Parameters
20
20
  ----------
@@ -47,7 +47,7 @@ def update_workspace_user(
47
47
  """
48
48
  Updates a user's role within a workspace.
49
49
 
50
- This is a wrapper function for the following API: `Groups - Update Group User <https://learn.microsoft.com/rest/api/power-bi/groups/update-group-user`_.
50
+ This is a wrapper function for the following API: `Groups - Update Group User <https://learn.microsoft.com/rest/api/power-bi/groups/update-group-user>`_.
51
51
 
52
52
  Parameters
53
53
  ----------
@@ -99,7 +99,7 @@ def list_workspace_users(workspace: Optional[str] = None) -> pd.DataFrame:
99
99
  """
100
100
  A list of all the users of a workspace and their roles.
101
101
 
102
- This is a wrapper function for the following API: `Workspaces - List Workspace Role Assignments <https://learn.microsoft.com/rest/api/fabric/core/workspaces/list-workspace-role-assignments`_.
102
+ This is a wrapper function for the following API: `Workspaces - List Workspace Role Assignments <https://learn.microsoft.com/rest/api/fabric/core/workspaces/list-workspace-role-assignments>`_.
103
103
 
104
104
  Parameters
105
105
  ----------
@@ -148,7 +148,7 @@ def add_user_to_workspace(
148
148
  """
149
149
  Adds a user to a workspace.
150
150
 
151
- This is a wrapper function for the following API: `Groups - Add Group User <https://learn.microsoft.com/rest/api/power-bi/groups/add-group-user`_.
151
+ This is a wrapper function for the following API: `Groups - Add Group User <https://learn.microsoft.com/rest/api/power-bi/groups/add-group-user>`_.
152
152
 
153
153
  Parameters
154
154
  ----------
@@ -204,7 +204,7 @@ def assign_workspace_to_capacity(capacity_name: str, workspace: Optional[str] =
204
204
  """
205
205
  Assigns a workspace to a capacity.
206
206
 
207
- This is a wrapper function for the following API: `Workspaces - Assign To Capacity <https://learn.microsoft.com/rest/api/fabric/core/workspaces/assign-to-capacity`_.
207
+ This is a wrapper function for the following API: `Workspaces - Assign To Capacity <https://learn.microsoft.com/rest/api/fabric/core/workspaces/assign-to-capacity>`_.
208
208
 
209
209
  Parameters
210
210
  ----------
@@ -238,7 +238,7 @@ def unassign_workspace_from_capacity(workspace: Optional[str] = None):
238
238
  """
239
239
  Unassigns a workspace from its assigned capacity.
240
240
 
241
- This is a wrapper function for the following API: `Workspaces - Unassign From Capacity <https://learn.microsoft.com/rest/api/fabric/core/workspaces/unassign-from-capacity`_.
241
+ This is a wrapper function for the following API: `Workspaces - Unassign From Capacity <https://learn.microsoft.com/rest/api/fabric/core/workspaces/unassign-from-capacity>`_.
242
242
 
243
243
  Parameters
244
244
  ----------
@@ -264,7 +264,7 @@ def list_workspace_role_assignments(workspace: Optional[str] = None) -> pd.DataF
264
264
  """
265
265
  Shows the members of a given workspace.
266
266
 
267
- This is a wrapper function for the following API: `Workspaces - List Workspace Role Assignments <https://learn.microsoft.com/rest/api/fabric/core/workspaces/list-workspace-role-assignments`_.
267
+ This is a wrapper function for the following API: `Workspaces - List Workspace Role Assignments <https://learn.microsoft.com/rest/api/fabric/core/workspaces/list-workspace-role-assignments>`_.
268
268
 
269
269
  Parameters
270
270
  ----------
@@ -13,6 +13,7 @@ from sempy_labs.admin._basic_functions import (
13
13
  list_workspace_access_details,
14
14
  list_items,
15
15
  list_activity_events,
16
+ list_modified_workspaces,
16
17
  )
17
18
  from sempy_labs.admin._domains import (
18
19
  list_domains,
@@ -52,4 +53,5 @@ __all__ = [
52
53
  "list_external_data_shares",
53
54
  "revoke_external_data_share",
54
55
  "list_activity_events",
56
+ "list_modified_workspaces",
55
57
  ]
@@ -366,7 +366,7 @@ def revoke_external_data_share(
366
366
  """
367
367
  Revokes the specified external data share. Note: This action cannot be undone.
368
368
 
369
- This is a wrapper function for the following API: `External Data Shares - Revoke External Data Share <https://learn.microsoft.com/rest/api/fabric/admin/external-data-shares/revoke-external-data-share`_.
369
+ This is a wrapper function for the following API: `External Data Shares - Revoke External Data Share <https://learn.microsoft.com/rest/api/fabric/admin/external-data-shares/revoke-external-data-share>`_.
370
370
 
371
371
  Parameters
372
372
  ----------
@@ -399,7 +399,7 @@ def list_capacities_delegated_tenant_settings(
399
399
  """
400
400
  Returns list of tenant setting overrides that override at the capacities.
401
401
 
402
- 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`_.
402
+ 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>`_.
403
403
 
404
404
  Parameters
405
405
  ----------
@@ -530,7 +530,7 @@ def list_datasets() -> pd.DataFrame:
530
530
  """
531
531
  Shows a list of datasets for the organization.
532
532
 
533
- 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`_.
533
+ 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>`_.
534
534
 
535
535
  Returns
536
536
  -------
@@ -620,7 +620,7 @@ def list_item_access_details(
620
620
  """
621
621
  Returns a list of users (including groups and service principals) and lists their workspace roles.
622
622
 
623
- 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`_.
623
+ 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>`_.
624
624
 
625
625
  Parameters
626
626
  ----------
@@ -688,7 +688,7 @@ def list_access_entities(
688
688
  """
689
689
  Shows a list of permission details for Fabric and Power BI items the specified user can access.
690
690
 
691
- 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`_.
691
+ 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>`_.
692
692
 
693
693
  Parameters
694
694
  ----------
@@ -740,7 +740,7 @@ def list_workspace_access_details(
740
740
  """
741
741
  Shows a list of users (including groups and Service Principals) that have access to the specified workspace.
742
742
 
743
- 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`_.
743
+ 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>`_.
744
744
 
745
745
  Parameters
746
746
  ----------
@@ -821,7 +821,7 @@ def list_items(
821
821
  """
822
822
  Shows a list of active Fabric and Power BI items.
823
823
 
824
- This is a wrapper function for the following API: `Items - List Items <https://learn.microsoft.com/rest/api/fabric/admin/items/list-items`_.
824
+ This is a wrapper function for the following API: `Items - List Items <https://learn.microsoft.com/rest/api/fabric/admin/items/list-items>`_.
825
825
 
826
826
  Parameters
827
827
  ----------
@@ -923,7 +923,7 @@ def list_activity_events(
923
923
  """
924
924
  Shows a list of audit activity events for a tenant.
925
925
 
926
- 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`_.
926
+ 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>`_.
927
927
 
928
928
  Parameters
929
929
  ----------
@@ -1031,3 +1031,49 @@ def list_activity_events(
1031
1031
  df["Creation Time"] = pd.to_datetime(df["Creation Time"])
1032
1032
 
1033
1033
  return df
1034
+
1035
+
1036
+ def list_modified_workspaces(
1037
+ modified_since: Optional[str] = None,
1038
+ exclude_inactive_workspaces: bool = False,
1039
+ exclude_personal_workspaces: bool = False,
1040
+ ) -> pd.DataFrame:
1041
+ """
1042
+ Gets a list of workspace IDs in the organization.
1043
+
1044
+ 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>`_.
1045
+
1046
+ Parameters
1047
+ ----------
1048
+ modified_since : str
1049
+ Last modified date (must be in ISO 8601 compliant UTC format). Example: "2024-11-02T05:51:30.0000000Z".
1050
+ exclude_inactive_workspaces : bool, default=False
1051
+ Whether to exclude inactive workspaces.
1052
+ exclude_personal_workspaces : bool, default=False
1053
+ Whether to exclude personal workspaces.
1054
+
1055
+ Returns
1056
+ -------
1057
+ pandas.DataFrame
1058
+ A pandas dataframe showing a list of workspace IDs in the organization.
1059
+ """
1060
+
1061
+ client = fabric.PowerBIRestClient()
1062
+ url = "/v1.0/myorg/admin/workspaces/modified?"
1063
+
1064
+ if modified_since is not None:
1065
+ url += f"modifiedSince={modified_since}&"
1066
+ if exclude_inactive_workspaces:
1067
+ url += f"excludeInActiveWorkspaces={exclude_inactive_workspaces}&"
1068
+ if exclude_personal_workspaces:
1069
+ url += f"excludePersonalWorkspaces={exclude_personal_workspaces}&"
1070
+
1071
+ url = url.rstrip("&").rstrip("?")
1072
+
1073
+ response = client.get(url)
1074
+ if response.status_code != 200:
1075
+ raise FabricHTTPException(response)
1076
+
1077
+ df = pd.DataFrame(response.json()).rename(columns={"id": "Workspace Id"})
1078
+
1079
+ return df
@@ -84,7 +84,7 @@ def list_domain_workspaces(domain_name: str) -> pd.DataFrame:
84
84
  """
85
85
  Shows a list of workspaces within the domain.
86
86
 
87
- 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?tabs=HTTP>`_.
87
+ 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>`_.
88
88
 
89
89
  Parameters
90
90
  ----------
@@ -71,7 +71,7 @@ def update_direct_lake_partition_entity(
71
71
  f"{icons.red_dot} The '{tName}' table in the '{dataset}' semantic model has not been updated."
72
72
  )
73
73
 
74
- tom.model.Tables[tName].Partitions[part_name].EntityName = eName
74
+ tom.model.Tables[tName].Partitions[part_name].Source.EntityName = eName
75
75
  print(
76
76
  f"{icons.green_dot} The '{tName}' table in the '{dataset}' semantic model has been updated to point to the '{eName}' table."
77
77
  )