sempy_labs.semantic_model package

Module contents

sempy_labs.semantic_model.approved_for_copilot(dataset: str | UUID, approved_for_copilot: bool, workspace: str | UUID | None = None)

Turn on this setting to approve your model for Copilot use. This improves visibility in search results and removes the warning in standalone Copilot in Power BI that your organization hasn’t approved the data.

Parameters:
  • dataset (str | uuid.UUID) – The name or UUID of the semantic model.

  • approved_for_copilot (bool) – Set to True to approve the model for Copilot use, or False to disapprove it.

  • 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.

sempy_labs.semantic_model.direct_lake_manager(dataset: str | UUID | None = None, workspace: str | UUID | None = None, dark_mode: bool = False)

Generates an interactive editor for managing Direct Lake semantic models.

The editor lets you pick an existing Direct Lake semantic model within a given workspace or create a new Direct Lake model from a supported source (leveraging sempy_labs.directlake.generate_direct_lake_semantic_model()). Once a model is open, you can add or edit sources, reassign tables to a different source, add new tables to the model, and refresh the model.

Parameters:
  • dataset (str | uuid.UUID, default=None) – Name or ID of a Direct Lake semantic model to open immediately. If None, the manager opens on the model-selection screen.

  • workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID where datasets are listed and where new models are created by default. Defaults to None which resolves to the workspace of the attached lakehouse or, if no lakehouse is attached, the workspace of the notebook.

  • dark_mode (bool, default=False) – If True, renders the manager with a dark color theme. If False, renders with a light color theme.

sempy_labs.semantic_model.enable_query_caching(dataset: str | UUID, workspace: str | UUID | None = None, enable: bool = True)

Enables or disables query caching for a semantic model.

Parameters:
  • dataset (str | uuid.UUID) – Name or ID of the semantic model.

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

  • enable (bool, default=True) – Set to True to enable query caching, or False to disable it.

sempy_labs.semantic_model.make_discoverable(dataset: str | UUID, make_discoverable: bool, workspace: str | UUID | None = None)

Allow users without access to this semantic model to discover it and request permissions to access the data. The semantic model must be endorsed as ‘Promoted’, ‘Certified’, or ‘Master data’ to be made discoverable.

Parameters:
  • dataset (str | uuid.UUID) – Name or ID of the semantic model.

  • make_discoverable (bool) – Whether to make the semantic model discoverable.

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

sempy_labs.semantic_model.perspective_editor(dataset: str | UUID, workspace: str | UUID | None = None, dark_mode: bool = False)

Generates an interactive editor for managing perspectives within a semantic model.

Parameters:
  • dataset (str | uuid.UUID) – Name or ID of the semantic model.

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

  • dark_mode (bool, default=False) – If True, renders the editor with a dark color theme. If False, renders with a light color theme.

sempy_labs.semantic_model.set_endorsement(dataset: str | UUID, endorsement: Literal['None', 'Promoted', 'Certified', 'Master data'], workspace: str | UUID | None = None)

Sets the endorsement status for a semantic model.

Parameters:
  • dataset (str | uuid.UUID) – Name or ID of the semantic model.

  • endorsement (Literal["None", "Promoted", "Certified", "Master data"]) – The endorsement status to set for the semantic model.

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