From 6fe5fb7f1c09fef9db4755d65f02aebae42797c8 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 13 Dec 2024 14:17:43 +0200 Subject: [PATCH 1/2] added list_serverproperties --- src/sempy_labs/__init__.py | 2 ++ src/sempy_labs/_git.py | 1 - src/sempy_labs/_list_functions.py | 26 ++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/sempy_labs/__init__.py b/src/sempy_labs/__init__.py index e0bf0dea..8a194149 100644 --- a/src/sempy_labs/__init__.py +++ b/src/sempy_labs/__init__.py @@ -205,6 +205,7 @@ list_lakehouses, list_sql_endpoints, update_item, + list_server_properties, ) from sempy_labs._helper_functions import ( convert_to_friendly_case, @@ -458,4 +459,5 @@ "update_vnet_gateway", "update_on_premises_gateway", "get_semantic_model_definition", + "list_server_properties", ] diff --git a/src/sempy_labs/_git.py b/src/sempy_labs/_git.py index 1de2fe2c..4e58078b 100644 --- a/src/sempy_labs/_git.py +++ b/src/sempy_labs/_git.py @@ -322,7 +322,6 @@ def commit_to_git( ) - def update_from_git( remote_commit_hash: str, conflict_resolution_policy: str, diff --git a/src/sempy_labs/_list_functions.py b/src/sempy_labs/_list_functions.py index f4157ccd..33c37ca6 100644 --- a/src/sempy_labs/_list_functions.py +++ b/src/sempy_labs/_list_functions.py @@ -1575,3 +1575,29 @@ def list_semantic_model_object_report_usage( final_df.reset_index(drop=True, inplace=True) return final_df + + +def list_server_properties(workspace: Optional[str | UUID] = None) -> pd.DataFrame: + + tom_server = fabric.create_tom_server(readonly=True, workspace=workspace) + + rows = [ + { + "Name": sp.Name, + "Value": sp.Value, + "Default Value": sp.DefaultValue, + "Is Read Only": sp.IsReadOnly, + "Requires Restart": sp.RequiresRestart, + "Units": sp.Units, + "Category": sp.Category, + } + for sp in tom_server.ServerProperties + ] + + tom_server.Dispose() + df = pd.DataFrame(rows) + + bool_cols = ["Is Read Only", "Requires Restart"] + df[bool_cols] = df[bool_cols].astype(bool) + + return df From 1df29ef64ebd5b2b04a8264e36b9f95c32074e93 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 13 Dec 2024 14:19:03 +0200 Subject: [PATCH 2/2] added help section --- src/sempy_labs/_list_functions.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/sempy_labs/_list_functions.py b/src/sempy_labs/_list_functions.py index 33c37ca6..3f67f532 100644 --- a/src/sempy_labs/_list_functions.py +++ b/src/sempy_labs/_list_functions.py @@ -1578,6 +1578,21 @@ def list_semantic_model_object_report_usage( def list_server_properties(workspace: Optional[str | UUID] = None) -> pd.DataFrame: + """ + Lists the `properties `_ of the Analysis Services instance. + + Parameters + ---------- + workspace : str, default=None + The Fabric workspace name. + 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 a list of the server properties. + """ tom_server = fabric.create_tom_server(readonly=True, workspace=workspace)