sempy_labs.graph_model package

Module contents

sempy_labs.graph_model.execute_query(graph_model: str | UUID, query: str, workspace: str | UUID | None = None) dict

Executes a query on the specified graph model.

This is a wrapper function for the following API: Items - ExecuteQuery.

Parameters:
  • graph_model (str | uuid.UUID) – The graph model name or ID.

  • query (str) – The query string.

  • workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. 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:

The response from the API.

Return type:

dict

sempy_labs.graph_model.get_queryable_graph_type(graph_model: str | UUID, workspace: str | UUID | None = None) dict

Gets the current queryable graph type.

This is a wrapper function for the following API: Items - GetQueryableGraphType.

Parameters:
  • graph_model (str | uuid.UUID) – The graph model name or ID.

  • workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. 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:

A dictionary showing the current queryable graph type.

Return type:

dict

sempy_labs.graph_model.list_graph_models(workspace: str | UUID | None = None) DataFrame

Shows the graph models within a workspace.

This is a wrapper function for the following API: Items - List Graph Models.

Parameters:

workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. 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:

A pandas dataframe showing the graph models within a workspace.

Return type:

pandas.DataFrame

sempy_labs.graph_model.refresh_graph(graph_model: str | UUID, workspace: str | UUID | None = None) DataFrame

Refreshes the graph model.

This is a wrapper function for the following API: Background Jobs - Run On Demand Refresh Graph.

Parameters:
  • graph_model (str | uuid.UUID) – The graph model name or ID.

  • workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. 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:

A pandas dataframe showing the result of the refresh operation.

Return type:

pandas.DataFrame