Skip to content

Commit

Permalink
Merge branch 'm-kovalsky/listserverproperties'
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kovalsky committed Dec 16, 2024
2 parents 3ef9b9c + 1df29ef commit 0277103
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/sempy_labs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
list_lakehouses,
list_sql_endpoints,
update_item,
list_server_properties,
)
from sempy_labs._helper_functions import (
convert_to_friendly_case,
Expand Down Expand Up @@ -460,4 +461,5 @@
"update_on_premises_gateway",
"get_semantic_model_definition",
"get_tenant_id",
"list_server_properties",
]
41 changes: 41 additions & 0 deletions src/sempy_labs/_list_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1575,3 +1575,44 @@ 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:
"""
Lists the `properties <https://learn.microsoft.com/dotnet/api/microsoft.analysisservices.serverproperty?view=analysisservices-dotnet>`_ 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)

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

0 comments on commit 0277103

Please sign in to comment.