Skip to content

Commit

Permalink
Merge branch 'm-kovalsky/datasetstoragemode'
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kovalsky committed Sep 16, 2024
2 parents ea3c838 + b9fbdeb commit 8fe139c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/sempy_labs/_query_scale_out.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,24 @@ def set_semantic_model_storage_format(
f"{icons.red_dot} Invalid storage format value. Valid options: {storageFormats}."
)

dfL = list_qso_settings(dataset=dataset, workspace=workspace)
current_storage_format = dfL["Storage Mode"].iloc[0]

if current_storage_format == storage_format:
print(
f"{icons.info} The '{dataset}' semantic model within the '{workspace}' workspace is already set to '{storage_format.lower()}' storage format."
)
return

client = fabric.PowerBIRestClient()
response = client.patch(
f"/v1.0/myorg/groups/{workspace_id}/datasets/{dataset_id}", json=request_body
)
if response.status_code != 200:
raise FabricHTTPException(response)
print(f"{icons.green_dot} Semantic model storage format set to '{storage_format}'.")
print(
f"{icons.green_dot} The semantic model storage format for the '{dataset}' semantic model within the '{workspace}' workspace has been set to '{storage_format}'."
)


def list_qso_settings(
Expand Down

0 comments on commit 8fe139c

Please sign in to comment.