Skip to content

Commit

Permalink
added resolve_item_name_and_id
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kovalsky committed Dec 18, 2024
1 parent 4f98dfa commit 54df7aa
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/sempy_labs/_helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,28 @@ def resolve_report_name(report_id: UUID, workspace: Optional[str | UUID] = None)
)


def resolve_item_name_and_id(item: str | UUID, type: Optional[str] = None, workspace: Optional[str | UUID] = None) -> Tuple[str, UUID]:

(workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)

if _is_valid_uuid(item):
item_id = item
item_name = fabric.resolve_item_name(
item_id=item_id, type=type, workspace=workspace_id
)
else:
if type is None:
raise ValueError(f"{icons.warning} Must specify a 'type' if specifying a name as the 'item'.")
item_name = item
item_id = fabric.resolve_item_id(
item_name=item, type=type, workspace=workspace_id
)

return item_name, item_id


def resolve_dataset_name_and_id(
dataset: str | UUID, workspace: Optional[str] = None
dataset: str | UUID, workspace: Optional[str | UUID] = None
) -> Tuple[str, UUID]:

(workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
Expand Down

0 comments on commit 54df7aa

Please sign in to comment.