From 62f315181b55759f136e3b91777aa5dfefe98fe6 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 4 Dec 2024 15:19:12 +0200 Subject: [PATCH] fixes per comments --- src/sempy_labs/admin/_basic_functions.py | 23 ++++++++++++++++++++--- src/sempy_labs/admin/_scanner.py | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/sempy_labs/admin/_basic_functions.py b/src/sempy_labs/admin/_basic_functions.py index 3656f6b4..bcdf045f 100644 --- a/src/sempy_labs/admin/_basic_functions.py +++ b/src/sempy_labs/admin/_basic_functions.py @@ -905,15 +905,15 @@ def _resolve_workspace_name_and_id( workspace_name = fabric.resolve_workspace_name(workspace_id) else: dfW = list_workspaces(workspace=workspace) - try: + if not dfW.empty: workspace_name = dfW["Name"].iloc[0] workspace_id = dfW["Id"].iloc[0] - except Exception: + else: raise ValueError( f"{icons.red_dot} The '{workspace}' workspace was not found." ) - return workspace_name, workspace_id + return workspace_name, workspace_id def list_reports( @@ -996,6 +996,23 @@ def list_reports( def get_capacity_assignment_status(workspace: Optional[str | UUID] = None): + """ + Gets the status of the assignment-to-capacity operation for the specified workspace. + + This is a wrapper function for the following API: `Capacities - Groups CapacityAssignmentStatus `_. + + Parameters + ---------- + workspace : str | UUID, default=None + The Fabric workspace name or id. + Defaults to None which resolves to the workspace of the attached lakehouse + or if no lakehouse attached, resolves to the workspace of the notebook. + + Returns + ------- + pandas.DataFrame + A pandas dataframe showing the status of the assignment-to-capacity operation for the specified workspace. + """ (workspace_name, workspace_id) = _resolve_workspace_name_and_id(workspace) diff --git a/src/sempy_labs/admin/_scanner.py b/src/sempy_labs/admin/_scanner.py index 10d67bde..84f56f09 100644 --- a/src/sempy_labs/admin/_scanner.py +++ b/src/sempy_labs/admin/_scanner.py @@ -40,7 +40,7 @@ def scan_workspaces( Returns ------- - dictionary + dict A json object with the scan result. """ scan_result = {