Skip to content

Commit

Permalink
Merge branch 'm-kovalsky/resetshortcutcache'
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kovalsky committed Jan 28, 2025
2 parents a3a0b7a + a430107 commit b74b32d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sempy_labs/admin/_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
):
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions src/sempy_labs/lakehouse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# create_shortcut,
create_shortcut_onelake,
delete_shortcut,
reset_shortcut_cache,
)

__all__ = [
Expand All @@ -21,4 +22,5 @@
"create_shortcut_onelake",
"delete_shortcut",
"vacuum_lakehouse_tables",
"reset_shortcut_cache",
]
28 changes: 28 additions & 0 deletions src/sempy_labs/lakehouse/_shortcuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://learn.microsoft.com/rest/api/fabric/core/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."
)

0 comments on commit b74b32d

Please sign in to comment.