Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M kovalsky/listserverproperties #351

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -458,4 +459,5 @@
"update_vnet_gateway",
"update_on_premises_gateway",
"get_semantic_model_definition",
"list_server_properties",
]
1 change: 0 additions & 1 deletion src/sempy_labs/_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ def commit_to_git(
)



def update_from_git(
remote_commit_hash: str,
conflict_resolution_policy: str,
Expand Down
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
Loading