diff --git a/src/sempy_labs/admin/_domains.py b/src/sempy_labs/admin/_domains.py index 93c10b9e..eb42ca73 100644 --- a/src/sempy_labs/admin/_domains.py +++ b/src/sempy_labs/admin/_domains.py @@ -302,7 +302,7 @@ def update_domain( def assign_domain_workspaces_by_capacities( - domain: Optional[str | UUID] = None, + domain: str | UUID, capacity_names: str | List[str], **kwargs, ): @@ -370,7 +370,7 @@ def assign_domain_workspaces_by_capacities( def assign_domain_workspaces( - domain: Optional[str | UUID], workspace_names: str | List[str] + domain: str | UUID, workspace_names: str | List[str] ): """ Assigns workspaces to the specified domain by workspace. diff --git a/src/sempy_labs/lakehouse/__init__.py b/src/sempy_labs/lakehouse/__init__.py index d1ce7c2d..b9340ac8 100644 --- a/src/sempy_labs/lakehouse/__init__.py +++ b/src/sempy_labs/lakehouse/__init__.py @@ -10,6 +10,7 @@ # create_shortcut, create_shortcut_onelake, delete_shortcut, + reset_shortcut_cache, ) __all__ = [ @@ -21,4 +22,5 @@ "create_shortcut_onelake", "delete_shortcut", "vacuum_lakehouse_tables", + "reset_shortcut_cache", ] diff --git a/src/sempy_labs/lakehouse/_shortcuts.py b/src/sempy_labs/lakehouse/_shortcuts.py index 58721ca2..2afd3f65 100644 --- a/src/sempy_labs/lakehouse/_shortcuts.py +++ b/src/sempy_labs/lakehouse/_shortcuts.py @@ -217,3 +217,31 @@ def delete_shortcut( print( f"{icons.green_dot} The '{shortcut_name}' shortcut in the '{lakehouse}' within the '{workspace_name}' workspace has been deleted." ) + + +def reset_shortcut_cache(workspace: Optional[str | UUID]): + """ + Deletes any cached files that were stored while reading from shortcuts. + + This is a wrapper function for the following API: `OneLake Shortcuts - Reset Shortcut Cache `_. + + Parameters + ---------- + workspace : str | uuid.UUID, default=None + The name or ID of the Fabric workspace. + Defaults to None which resolves to the workspace of the attached lakehouse + or if no lakehouse attached, resolves to the workspace of the notebook. + """ + + (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace) + + _base_api( + request=f"/v1/workspaces/{workspace_id}/onelake/resetShortcutCache", + method="post", + lro_return_status_code=True, + status_codes=None, + ) + + print( + f"{icons.green_dot} The shortcut cache has been reset for the '{workspace_name}' workspace." + )