sempy_labs package

Subpackages

Module contents

class sempy_labs.ConnectLakehouse(lakehouse: str, workspace: str | UUID | None = None, timeout: int | None = None)

Bases: ConnectBase

class sempy_labs.ConnectWarehouse(warehouse: str, workspace: str | UUID | None = None, timeout: int | None = None)

Bases: ConnectBase

sempy_labs.add_user_to_workspace(email_address: str, role_name: str, principal_type: str | None = 'User', workspace: str | None = None)

Adds a user to a workspace.

Parameters:
  • email_address (str) – The email address of the user.

  • role_name (str) – The role of the user within the workspace.

  • principal_type (str, default='User') – The principal type.

  • workspace (str, default=None) – The name of the workspace. 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.assign_workspace_to_capacity(capacity_name: str, workspace: str | None = None)

Assigns a workspace to a capacity.

Parameters:
  • capacity_name (str) – The name of the capacity.

  • workspace (str, default=None) – The name of the Fabric workspace. 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.assign_workspace_to_dataflow_storage(dataflow_storage_account: str, workspace: str | None = None)

Assigns a dataflow storage account to a workspace.

Parameters:
  • dataflow_storage_account (str) – The name of the dataflow storage account.

  • workspace (str, default=None) – The name of the workspace. 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.backup_semantic_model(dataset: str, file_path: str, allow_overwrite: bool = True, apply_compression: bool = True, workspace: str | None = None)

Backs up a semantic model to the ADLS Gen2 storage account connected to the workspace.

Parameters:
  • dataset (str) – Name of the semantic model.

  • file_path (str) – The ADLS Gen2 storage account location in which to backup the semantic model. Always saves within the ‘power-bi-backup/<workspace name>’ folder. Must end in ‘.abf’. Example 1: file_path = ‘MyModel.abf’ Example 2: file_path = ‘MyFolder/MyModel.abf’

  • allow_overwrite (bool, default=True) – If True, overwrites backup files of the same name. If False, the file you are saving cannot have the same name as a file that already exists in the same location.

  • apply_compression (bool, default=True) – If True, compresses the backup file. Compressed backup files save disk space, but require slightly higher CPU utilization.

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

sempy_labs.cancel_dataset_refresh(dataset: str, request_id: str | None = None, workspace: str | None = None)

Cancels the refresh of a semantic model which was executed via the Enhanced Refresh API

Parameters:
  • dataset (str) – Name of the semantic model.

  • request_id (str, default=None) – The request id of a semantic model refresh. Defaults to finding the latest active refresh of the semantic model.

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

sempy_labs.check_fabric_capacity_name_availablility(capacity_name: str, azure_subscription_id: str, region: str, key_vault_uri: str, key_vault_tenant_id: str, key_vault_client_id: str, key_vault_client_secret: str) bool

This function updates a Fabric capacity’s properties.

Parameters:
  • capacity_name (str) – Name of the Fabric capacity.

  • azure_subscription_id (str) – The Azure subscription ID.

  • region (str) – The region name.

  • key_vault_uri (str) – The name of the Azure key vault URI. Example: “https://<Key Vault Name>.vault.azure.net/”

  • key_vault_tenant_id (str) – The name of the Azure key vault secret storing the Tenant ID.

  • key_vault_client_id (str) – The name of the Azure key vault secret storing the Client ID.

  • key_vault_client_secret (str) – The name of the Azure key vault secret storing the Client Secret.

Returns:

An indication as to whether the Fabric capacity name is available or not.

Return type:

bool

sempy_labs.clear_cache(dataset: str, workspace: str | None = None)

Clears the cache of a semantic model. See here for documentation.

Parameters:
  • dataset (str) – Name of the semantic model.

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

sempy_labs.commit_to_git(comment: str, item_ids: str | List[str] = None, workspace: str | None = None)

Commits all or a selection of items within a workspace to Git.

Parameters:
  • comment (str) – The Git commit comment.

  • item_ids (str | List[str], default=None) – A list of item Ids to commit to Git. Defaults to None which commits all items to Git.

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

sempy_labs.connect_workspace_to_git(organization_name: str, project_name: str, repository_name: str, branch_name: str, directory_name: str, git_provider_type: str = 'AzureDevOps', workspace: str | None = None)

Connects a workspace to a git repository.

Parameters:
  • organization_name (str) – The organization name.

  • project_name (str) – The project name.

  • repository_name (str) – The repository name.

  • branch_name (str) – The branch name.

  • directory_name (str) – The directory name.

  • git_provider_type (str, default="AzureDevOps") – A Git provider type.

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

sempy_labs.convert_to_friendly_case(text: str) str

Converts a string of pascal/camel/snake case to business-friendly case.

Parameters:

text (str) – The text to convert.

Returns:

Text converted into a business-friendly text.

Return type:

str

sempy_labs.copy_semantic_model_backup_file(source_workspace: str, target_workspace: str, source_file_name: str, target_file_name: str, storage_account: str, source_file_system: str = 'power-bi-backup', target_file_system: str = 'power-bi-backup')

Copies a semantic model backup file (.abf) from an Azure storage account to another location within the Azure storage account.

Requirements:
  1. Must have an Azure storage account and connect it to both the source and target workspace.

  2. Must be a ‘Storage Blob Data Contributor’ for the storage account.
    Steps:
    1. Navigate to the storage account within the Azure Portal

    2. Navigate to ‘Access Control (IAM)’

    3. Click ‘+ Add’ -> Add Role Assignment

    4. Search for ‘Storage Blob Data Contributor’, select it and click ‘Next’

    5. Add yourself as a member, click ‘Next’

    6. Click ‘Review + assign’

Parameters:
  • source_workspace (str) – The workspace name of the source semantic model backup file.

  • target_workspace (str) – The workspace name of the target semantic model backup file destination.

  • source_file_name (str) – The name of the source backup file (i.e. MyModel.abf).

  • target_file_name (str) – The name of the target backup file (i.e. MyModel.abf).

  • storage_account (str) – The name of the storage account.

  • source_file_system (str, default="power-bi-backup") – The container in which the source backup file is located.

  • target_file_system (str, default="power-bi-backup") – The container in which the target backup file will be saved.

sempy_labs.create_abfss_path(lakehouse_id: UUID, lakehouse_workspace_id: UUID, delta_table_name: str) str

Creates an abfss path for a delta table in a Fabric lakehouse.

Parameters:
  • lakehouse_id (UUID) – ID of the Fabric lakehouse.

  • lakehouse_workspace_id (UUID) – ID of the Fabric workspace.

  • delta_table_name (str) – Name of the delta table name.

Returns:

An abfss path which can be used to save/reference a delta table in a Fabric lakehouse.

Return type:

str

sempy_labs.create_blank_semantic_model(dataset: str, compatibility_level: int = 1605, workspace: str | None = None, overwrite: bool = True)

Creates a new blank semantic model (no tables/columns etc.).

Parameters:
  • dataset (str) – Name of the semantic model.

  • compatibility_level (int, default=1605) – The compatibility level of the semantic model.

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

  • overwrite (bool, default=False) – If set to True, overwrites the existing semantic model in the workspace if it exists.

sempy_labs.create_custom_pool(pool_name: str, node_size: str, min_node_count: int, max_node_count: int, min_executors: int, max_executors: int, node_family: str = 'MemoryOptimized', auto_scale_enabled: bool = True, dynamic_executor_allocation_enabled: bool = True, workspace: str | None = None)

Creates a custom pool within a workspace.

Parameters:
  • pool_name (str) – The custom pool name.

  • node_size (str) – The node size.

  • min_node_count (int) – The minimum node count.

  • max_node_count (int) – The maximum node count.

  • min_executors (int) – The minimum executors.

  • max_executors (int) – The maximum executors.

  • node_family (str, default='MemoryOptimized') – The node family.

  • auto_scale_enabled (bool, default=True) – The status of auto scale.

  • dynamic_executor_allocation_enabled (bool, default=True) – The status of the dynamic executor allocation.

  • workspace (str, default=None) – The name of the Fabric workspace. 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.create_data_pipeline(name: str, description: str | None = None, workspace: str | None = None)

Creates a Fabric data pipeline.

Parameters:
  • name (str) – Name of the data pipeline.

  • description (str, default=None) – A description of the environment.

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

sempy_labs.create_environment(environment: str, description: str | None = None, workspace: str | None = None)

Creates a Fabric environment.

Parameters:
  • environment (str) – Name of the environment.

  • description (str, default=None) – A description of the environment.

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

sempy_labs.create_eventhouse(name: str, description: str | None = None, workspace: str | None = None)

Creates a Fabric eventhouse.

Parameters:
  • name (str) – Name of the eventhouse.

  • description (str, default=None) – A description of the environment.

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

sempy_labs.create_eventstream(name: str, description: str | None = None, workspace: str | None = None)

Creates a Fabric eventstream.

Parameters:
  • name (str) – Name of the eventstream.

  • description (str, default=None) – A description of the environment.

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

sempy_labs.create_external_data_share(item_name: str, item_type: str, paths: str | List[str], recipient: str, workspace: str | None = None)

Creates an external data share for a given path or list of paths in the specified item.

Parameters:
  • item_name (str) – The item name.

  • item_type (str) – The item type.

  • paths (str | List[str]) – The path or list of paths that are to be externally shared. Currently, only a single path is supported.

  • recipient (str) – The email address of the recipient.

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

sempy_labs.create_fabric_capacity(capacity_name: str, azure_subscription_id: str, key_vault_uri: str, key_vault_tenant_id: str, key_vault_client_id: str, key_vault_client_secret: str, resource_group: str, region: str, sku: str, admin_members: str | List[str], tags: dict | None = None)

This function creates a new Fabric capacity within an Azure subscription.

Parameters:
  • capacity_name (str) – Name of the Fabric capacity.

  • azure_subscription_id (str) – The Azure subscription ID.

  • key_vault_uri (str) –

    The name of the Azure key vault URI. Example: “https://<Key Vault Name>.vault.azure.net/”

  • key_vault_tenant_id (str) – The name of the Azure key vault secret storing the Tenant ID.

  • key_vault_client_id (str) – The name of the Azure key vault secret storing the Client ID.

  • key_vault_client_secret (str) – The name of the Azure key vault secret storing the Client Secret.

  • resource_group (str) – The name of the Azure resource group.

  • region (str) – The name of the region in which the capacity will be created.

  • sku (str) – The sku size of the Fabric capacity.

  • admin_members (str | List[str]) – The email address(es) of the admin(s) of the Fabric capacity.

  • tags (dict, default=None) – Tag(s) to add to the capacity. Example: {‘tagName’: ‘tagValue’}.

sempy_labs.create_kql_database(name: str, description: str | None = None, workspace: str | None = None)

Creates a KQL database.

Parameters:
  • name (str) – Name of the KQL database.

  • description (str, default=None) – A description of the environment.

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

sempy_labs.create_kql_queryset(name: str, description: str | None = None, workspace: str | None = None)

Creates a KQL queryset.

Parameters:
  • name (str) – Name of the KQL queryset.

  • description (str, default=None) – A description of the environment.

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

sempy_labs.create_ml_experiment(name: str, description: str | None = None, workspace: str | None = None)

Creates a Fabric ML experiment.

Parameters:
  • name (str) – Name of the ML experiment.

  • description (str, default=None) – A description of the environment.

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

sempy_labs.create_ml_model(name: str, description: str | None = None, workspace: str | None = None)

Creates a Fabric ML model.

Parameters:
  • name (str) – Name of the ML model.

  • description (str, default=None) – A description of the environment.

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

sempy_labs.create_model_bpa_semantic_model(dataset: str | None = 'ModelBPA', lakehouse: str | None = None, lakehouse_workspace: str | None = None)

Dynamically generates a Direct Lake semantic model based on the ‘modelbparesults’ delta table which contains the Best Practice Analyzer results. This semantic model used in combination with the corresponding Best Practice Analyzer report can be used to analyze multiple semantic models on multiple workspaces at once (and over time).

The semantic model is always created within the same workspace as the lakehouse.

Parameters:
  • dataset (str, default='ModelBPA') – Name of the semantic model to be created.

  • lakehouse (str, default=None) – Name of the Fabric lakehouse which contains the ‘modelbparesults’ delta table. Defaults to None which resolves to the default lakehouse attached to the notebook.

  • lakehouse_workspace (str, default=None) – The workspace in which the lakehouse resides. 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.create_relationship_name(from_table: str, from_column: str, to_table: str, to_column: str) str

Formats a relationship’s table/columns into a fully qualified name.

Parameters:
  • from_table (str) – The name of the table on the ‘from’ side of the relationship.

  • from_column (str) – The name of the column on the ‘from’ side of the relationship.

  • to_table (str) – The name of the table on the ‘to’ side of the relationship.

  • to_column (str) – The name of the column on the ‘to’ side of the relationship.

Returns:

The fully qualified relationship name.

Return type:

str

sempy_labs.create_resource_group(azure_subscription_id: str, key_vault_uri: str, key_vault_tenant_id: str, key_vault_client_id: str, key_vault_client_secret: str, resource_group: str, region: str)

This function creates a resource group in a region within an Azure subscription.

Parameters:
  • azure_subscription_id (str) – The Azure subscription ID.

  • key_vault_uri (str) –

    The name of the Azure key vault URI. Example: “https://<Key Vault Name>.vault.azure.net/”

  • key_vault_tenant_id (str) – The name of the Azure key vault secret storing the Tenant ID.

  • key_vault_client_id (str) – The name of the Azure key vault secret storing the Client ID.

  • key_vault_client_secret (str) – The name of the Azure key vault secret storing the Client Secret.

  • resource_group (str) – The name of the Azure resource group to be created.

  • region (str) – The name of the region in which the resource group will be created.

sempy_labs.create_semantic_model_from_bim(dataset: str, bim_file: dict, workspace: str | None = None)

Creates a new semantic model based on a Model.bim file.

Parameters:
  • dataset (str) – Name of the semantic model.

  • bim_file (dict) – The model.bim file.

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

sempy_labs.create_warehouse(warehouse: str, description: str | None = None, case_insensitive_collation: bool = False, workspace: str | None = None)

Creates a Fabric warehouse.

Parameters:
  • warehouse (str) – Name of the warehouse.

  • description (str, default=None) – A description of the warehouse.

  • case_insensitive_collation (bool, default=False) – If True, creates the warehouse with case-insensitive collation.

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

sempy_labs.delete_custom_pool(pool_name: str, workspace: str | None = None)

Deletes a custom pool within a workspace.

Parameters:
  • pool_name (str) – The custom pool name.

  • workspace (str, default=None) – The name of the Fabric workspace. 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.delete_data_pipeline(name: str, workspace: str | None = None)

Deletes a Fabric data pipeline.

Parameters:
  • name (str) – Name of the data pipeline.

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

sempy_labs.delete_embedded_capacity(capacity_name: str, azure_subscription_id: str, resource_group: str, key_vault_uri: str, key_vault_tenant_id: str, key_vault_client_id: str, key_vault_client_secret: str)

This function deletes a Power BI Embedded capacity.

Parameters:
  • capacity_name (str) – Name of the Fabric capacity.

  • azure_subscription_id (str) – The Azure subscription ID.

  • resource_group (str) – The name of the Azure resource group.

  • key_vault_uri (str) –

    The name of the Azure key vault URI. Example: “https://<Key Vault Name>.vault.azure.net/”

  • key_vault_tenant_id (str) – The name of the Azure key vault secret storing the Tenant ID.

  • key_vault_client_id (str) – The name of the Azure key vault secret storing the Client ID.

  • key_vault_client_secret (str) – The name of the Azure key vault secret storing the Client Secret.

sempy_labs.delete_environment(environment: str, workspace: str | None = None)

Deletes a Fabric environment.

Parameters:
  • environment (str) – Name of the environment.

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

sempy_labs.delete_eventhouse(name: str, workspace: str | None = None)

Deletes a Fabric eventhouse.

Parameters:
  • name (str) – Name of the eventhouse.

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

sempy_labs.delete_eventstream(name: str, workspace: str | None = None)

Deletes a Fabric eventstream.

Parameters:
  • name (str) – Name of the eventstream.

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

sempy_labs.delete_fabric_capacity(capacity_name: str, azure_subscription_id: str, resource_group: str, key_vault_uri: str, key_vault_tenant_id: str, key_vault_client_id: str, key_vault_client_secret: str)

This function deletes a Fabric capacity.

Parameters:
  • capacity_name (str) – Name of the Fabric capacity.

  • azure_subscription_id (str) – The Azure subscription ID.

  • resource_group (str) – The name of the Azure resource group.

  • key_vault_uri (str) –

    The name of the Azure key vault URI. Example: “https://<Key Vault Name>.vault.azure.net/”

  • key_vault_tenant_id (str) – The name of the Azure key vault secret storing the Tenant ID.

  • key_vault_client_id (str) – The name of the Azure key vault secret storing the Client ID.

  • key_vault_client_secret (str) – The name of the Azure key vault secret storing the Client Secret.

sempy_labs.delete_kql_database(name: str, workspace: str | None = None)

Deletes a KQL database.

Parameters:
  • name (str) – Name of the KQL database.

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

sempy_labs.delete_kql_queryset(name: str, workspace: str | None = None)

Deletes a KQL queryset.

Parameters:
  • name (str) – Name of the KQL queryset.

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

sempy_labs.delete_ml_experiment(name: str, workspace: str | None = None)

Deletes a Fabric ML experiment.

Parameters:
  • name (str) – Name of the ML experiment.

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

sempy_labs.delete_ml_model(name: str, workspace: str | None = None)

Deletes a Fabric ML model.

Parameters:
  • name (str) – Name of the ML model.

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

sempy_labs.delete_premium_capacity(capacity_name: str)

This function deletes a Power BI Premium capacity.

Parameters:

capacity_name (str) – Name of the Fabric capacity.

sempy_labs.delete_user_from_workspace(email_address: str, workspace: str | None = None)

Removes a user from a workspace.

Parameters:
  • email_address (str) – The email address of the user.

  • workspace (str, default=None) – The name of the workspace. 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.delete_warehouse(name: str, workspace: str | None = None)

Deletes a Fabric warehouse.

Parameters:
  • name (str) – Name of the warehouse.

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

sempy_labs.deploy_semantic_model(source_dataset: str, source_workspace: str | None = None, target_dataset: str | None = None, target_workspace: str | None = None, refresh_target_dataset: bool = True, overwrite: bool = False)

Deploys a semantic model based on an existing semantic model.

Parameters:
  • source_dataset (str) – Name of the semantic model to deploy.

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

  • target_dataset (str) – Name of the new semantic model to be created.

  • target_workspace (str, default=None) – The Fabric workspace name in which the new semantic model will be deployed. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

  • refresh_target_dataset (bool, default=True) – If set to True, this will initiate a full refresh of the target semantic model in the target workspace.

  • overwrite (bool, default=False) – If set to True, overwrites the existing semantic model in the workspace if it exists.

sempy_labs.deprovision_workspace_identity(workspace: str | None = None)

Deprovisions a workspace identity for a workspace.

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.

sempy_labs.disable_qso(dataset: str, workspace: str | None = None) DataFrame

Sets the max read-only replicas to 0, disabling query scale out.

Parameters:
  • dataset (str) – Name of the semantic model.

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

A pandas dataframe showing the current query scale out settings.

Return type:

pandas.DataFrame

sempy_labs.disconnect_workspace_from_git(workspace: str | None = None)

Disconnects a workpsace from a git repository.

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.

sempy_labs.evaluate_dax_impersonation(dataset: str, dax_query: str, user_name: str | None = None, workspace: str | None = None)

Runs a DAX query against a semantic model using the REST API.

Compared to evaluate_dax this allows passing the user name for impersonation. Note that the REST API has significant limitations compared to the XMLA endpoint.

Parameters:
  • dataset (str) – Name of the semantic model.

  • dax_query (str) – The DAX query.

  • user_name (str) – The user name (i.e. hello@goodbye.com).

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

A pandas dataframe holding the result of the DAX query.

Return type:

pandas.DataFrame

sempy_labs.export_model_to_onelake(dataset: str, workspace: str | None = None, destination_lakehouse: str | None = None, destination_workspace: str | None = None)

Exports a semantic model’s tables to delta tables in the lakehouse. Creates shortcuts to the tables if a lakehouse is specified.

Parameters:
  • dataset (str) – Name of the semantic model.

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

  • destination_lakehouse (str, default=None) – The name of the Fabric lakehouse where shortcuts will be created to access the delta tables created by the export. If the lakehouse specified does not exist, one will be created with that name. If no lakehouse is specified, shortcuts will not be created.

  • destination_workspace (str, default=None) – The name of the Fabric workspace in which the lakehouse resides.

sempy_labs.format_dax_object_name(table: str, column: str) str

Formats a table/column combination to the ‘Table Name’[Column Name] format.

Parameters:
  • table (str) – The name of the table.

  • column (str) – The name of the column.

Returns:

The fully qualified object name.

Return type:

str

sempy_labs.generate_embedded_filter(filter: str) str

Converts the filter expression to a filter expression which can be used by a Power BI embedded URL.

Parameters:

filter (str) – The filter expression for an embedded Power BI report.

Returns:

A filter expression usable by a Power BI embedded URL.

Return type:

str

sempy_labs.get_capacity_id(workspace: str | None = None) UUID

Obtains the Capacity Id for a given workspace.

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:

The capacity Id.

Return type:

UUID

sempy_labs.get_capacity_name(workspace: str | None = None) str

Obtains the capacity name for a given workspace.

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:

The capacity name.

Return type:

str

sempy_labs.get_data_pipeline_definition(name: str, workspace: str | None = None, decode: bool = True) dict | DataFrame

Obtains the definition of a data pipeline.

Parameters:
  • name (str) – The name of the data pipeline.

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

  • decode (bool, default=True) – decode : bool, default=True If True, decodes the data pipeline definition file into .json format. If False, obtains the data pipeline definition file a pandas DataFrame format.

Returns:

A pandas dataframe showing the data pipelines within a workspace.

Return type:

dict | pandas.DataFrame

sempy_labs.get_direct_lake_sql_endpoint(dataset: str, workspace: str | None = None) UUID

Obtains the SQL Endpoint ID of the semantic model.

Parameters:
  • dataset (str) – The name of the semantic model.

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

The ID of SQL Endpoint.

Return type:

uuid.UUID

sempy_labs.get_git_connection(workspace: str | None = None) DataFrame

Obtains the Git status of items in the workspace, that can be committed to Git.

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:

A pandas dataframe showing the Git status of items in the workspace.

Return type:

pandas.DataFrame

sempy_labs.get_git_status(workspace: str | None = None) DataFrame

Obtains the Git status of items in the workspace, that can be committed to Git.

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:

A pandas dataframe showing the Git status of items in the workspace.

Return type:

pandas.DataFrame

sempy_labs.get_measure_dependencies(dataset: str, workspace: str | None = None) DataFrame

Shows all dependencies for all measures in a semantic model.

Parameters:
  • dataset (str) – Name of the semantic model.

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

Shows all dependencies for all measures in the semantic model.

Return type:

pandas.DataFrame

sempy_labs.get_model_calc_dependencies(dataset: str, workspace: str | None = None) DataFrame

Shows all dependencies for all objects in a semantic model.

Parameters:
  • dataset (str) – Name of the semantic model.

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

Shows all dependencies for all objects in the semantic model.

Return type:

pandas.DataFrame

sempy_labs.get_notebook_definition(notebook_name: str, workspace: str | None = None, decode: bool = True) str

Obtains the notebook definition.

Parameters:
  • notebook_name (str) – The name of the notebook.

  • workspace (str, default=None) – The name of the workspace. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

  • decode (bool, default=True) – If True, decodes the notebook definition file into .ipynb format. If False, obtains the notebook definition file in base64 format.

Returns:

The notebook definition.

Return type:

str

sempy_labs.get_object_level_security(dataset: str, workspace: str | None = None) DataFrame

Shows the object level security for the semantic model.

Parameters:
  • dataset (str) – Name of the semantic model.

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

A pandas dataframe showing the object level security for the semantic model.

Return type:

pandas.DataFrame

sempy_labs.get_semantic_model_bim(dataset: str, workspace: str | None = None, save_to_file_name: str | None = None, lakehouse_workspace: str | None = None) dict

Extracts the Model.bim file for a given semantic model.

Parameters:
  • dataset (str) – Name of the semantic model.

  • workspace (str, default=None) – The Fabric workspace name in which the semantic model resides. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

  • save_to_file_name (str, default=None) – If specified, saves the Model.bim as a file in the lakehouse attached to the notebook.

  • lakehouse_workspace (str, default=None) – The Fabric workspace name in which the lakehouse attached to the workspace resides. 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 Model.bim file for the semantic model.

Return type:

dict

sempy_labs.get_semantic_model_size(dataset: str, workspace: str | None = None)
sempy_labs.get_spark_settings(workspace: str | None = None, return_dataframe: bool = True) DataFrame | dict

Shows the spark settings for a workspace.

Parameters:
  • workspace (str, default=None) – The name of the Fabric workspace. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

  • return_dataframe (bool, default=True) – If True, returns a pandas dataframe. If False, returns a json dictionary.

Returns:

A pandas dataframe showing the spark settings for a workspace.

Return type:

pandas.DataFrame | dict

sempy_labs.import_notebook_from_web(notebook_name: str, url: str, description: str | None = None, workspace: str | None = None)

Creates a new notebook within a workspace based on a Jupyter notebook hosted in the web.

Note: When specifying a notebook from GitHub, please use the raw file path. Note that if the non-raw file path is specified, the url will be converted to the raw URL as the raw URL is needed to obtain the notebook content.

Parameters:
  • notebook_name (str) – The name of the notebook to be created.

  • url (str) – The url of the Jupyter Notebook (.ipynb)

  • description (str, default=None) – The description of the notebook. Defaults to None which does not place a description.

  • workspace (str, default=None) – The name of the workspace. 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.import_vertipaq_analyzer(folder_path: str, file_name: str)

Imports and visualizes the vertipaq analyzer info from a saved .zip file in your lakehouse.

Parameters:
  • folder_path (str) – The folder within your lakehouse in which the .zip file containing the vertipaq analyzer info has been saved.

  • file_name (str) – The file name of the file which contains the vertipaq analyzer info.

Returns:

A visualization of the Vertipaq Analyzer statistics.

Return type:

str

sempy_labs.initialize_git_connection(workspace: str | None = None)

Initializes a connection for a workspace that is connected to Git.

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.

sempy_labs.is_default_semantic_model(dataset: str, workspace: str | None = None) bool

Identifies whether a semantic model is a default semantic model.

Parameters:
  • dataset (str) – The name of the semantic model.

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

A True/False value indicating whether the semantic model is a default semantic model.

Return type:

bool

sempy_labs.list_backups(workspace: str | None = None) DataFrame

Shows a list of backup files contained within a workspace’s ADLS Gen2 storage account. Requirement: An ADLS Gen2 storage account must be connected to the workspace.

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:

A pandas dataframe showing a list of backup files contained within a workspace’s ADLS Gen2 storage account.

Return type:

pandas.DataFrame

sempy_labs.list_capacities() DataFrame

Shows the capacities and their properties.

Returns:

A pandas dataframe showing the capacities and their properties

Return type:

pandas.DataFrame

sempy_labs.list_connections() DataFrame

Lists all available connections.

Returns:

A pandas dataframe showing all available connections.

Return type:

pandas.DataFrame

sempy_labs.list_custom_pools(workspace: str | None = None) DataFrame

Lists all custom pools within a workspace.

Parameters:

workspace (str, default=None) – The name of the Fabric workspace. 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 all the custom pools within the Fabric workspace.

Return type:

pandas.DataFrame

sempy_labs.list_dashboards(workspace: str | None = None) DataFrame

Shows a list of the dashboards within a workspace.

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:

A pandas dataframe showing the dashboards within a workspace.

Return type:

pandas.DataFrame

sempy_labs.list_data_pipelines(workspace: str | None = None) DataFrame

Shows the data pipelines within a workspace.

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:

A pandas dataframe showing the data pipelines within a workspace.

Return type:

pandas.DataFrame

sempy_labs.list_dataflow_storage_accounts() DataFrame

Shows the accessible dataflow storage accounts.

Returns:

A pandas dataframe showing the accessible dataflow storage accounts.

Return type:

pandas.DataFrame

sempy_labs.list_dataflows(workspace: str | None = None)

Shows a list of all dataflows which exist within a workspace.

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:

A pandas dataframe showing the dataflows which exist within a workspace.

Return type:

pandas.DataFrame

sempy_labs.list_datamarts(workspace: str | None = None) DataFrame

Shows the datamarts within a workspace.

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:

A pandas dataframe showing the datamarts within a workspace.

Return type:

pandas.DataFrame

sempy_labs.list_deployment_pipeline_stage_items(deployment_pipeline: str, stage_name: str) DataFrame

Shows the supported items from the workspace assigned to the specified stage of the specified deployment pipeline.

Parameters:
  • deployment_pipeline (str) – The deployment pipeline name.

  • stage_name (str) – The deployment pipeline stage name.

Returns:

A pandas dataframe showing the supported items from the workspace assigned to the specified stage of the specified deployment pipeline.

Return type:

pandas.DataFrame

sempy_labs.list_deployment_pipeline_stages(deployment_pipeline: str) DataFrame

Shows the specified deployment pipeline stages.

Parameters:

deployment_pipeline (str) – The deployment pipeline name.

Returns:

A pandas dataframe showing the specified deployment pipeline stages.

Return type:

pandas.DataFrame

sempy_labs.list_deployment_pipelines() DataFrame

Shows a list of deployment pipelines the user can access.

Returns:

A pandas dataframe showing a list of deployment pipelines the user can access.

Return type:

pandas.DataFrame

sempy_labs.list_eventhouses(workspace: str | None = None) DataFrame

Shows the eventhouses within a workspace.

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:

A pandas dataframe showing the eventhouses within a workspace.

Return type:

pandas.DataFrame

sempy_labs.list_eventstreams(workspace: str | None = None) DataFrame

Shows the eventstreams within a workspace.

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:

A pandas dataframe showing the eventstreams within a workspace.

Return type:

pandas.DataFrame

sempy_labs.list_external_data_shares_in_item(item_name: str, item_type: str, workspace: str | None = None) DataFrame

Returns a list of the external data shares that exist for the specified item.

Parameters:
  • item_name (str) – The item name.

  • item_type (str) –

    The item type.

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

A pandas dataframe showing a list of the external data shares that exist for the specified item.

Return type:

pandas.DataFrame

sempy_labs.list_item_connections(item_name: str, item_type: str, workspace: str | None = None) DataFrame

Shows the list of connections that the specified item is connected to.

Parameters:
  • item_name (str) – The item name.

  • item_type (str) –

    The item type.

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

A pandas dataframe showing the list of connections that the specified item is connected to.

Return type:

pandas.DataFrame

sempy_labs.list_kql_databases(workspace: str | None = None) DataFrame

Shows the KQL databases within a workspace.

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:

A pandas dataframe showing the KQL databases within a workspace.

Return type:

pandas.DataFrame

sempy_labs.list_kql_querysets(workspace: str | None = None) DataFrame

Shows the KQL querysets within a workspace.

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:

A pandas dataframe showing the KQL querysets within a workspace.

Return type:

pandas.DataFrame

sempy_labs.list_lakehouses(workspace: str | None = None) DataFrame

Shows the lakehouses within a workspace.

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:

A pandas dataframe showing the lakehouses within a workspace.

Return type:

pandas.DataFrame

sempy_labs.list_mirrored_warehouses(workspace: str | None = None) DataFrame

Shows the mirrored warehouses within a workspace.

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:

A pandas dataframe showing the mirrored warehouses within a workspace.

Return type:

pandas.DataFrame

sempy_labs.list_ml_experiments(workspace: str | None = None) DataFrame

Shows the ML experiments within a workspace.

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:

A pandas dataframe showing the ML models within a workspace.

Return type:

pandas.DataFrame

sempy_labs.list_ml_models(workspace: str | None = None) DataFrame

Shows the ML models within a workspace.

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:

A pandas dataframe showing the ML models within a workspace.

Return type:

pandas.DataFrame

sempy_labs.list_qso_settings(dataset: str | None = None, workspace: str | None = None) DataFrame

Shows the query scale out settings for a semantic model (or all semantic models within a workspace).

Parameters:
  • dataset (str, default=None) – Name of the semantic model.

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

A pandas dataframe showing the query scale out settings.

Return type:

pandas.DataFrame

sempy_labs.list_report_semantic_model_objects(dataset: str, workspace: str | None = None, extended: bool = False) DataFrame

Shows a list of semantic model objects (i.e. columns, measures, hierarchies) used in all reports which feed data from a given semantic model.

Requirement: Reports must be in the PBIR format.

Parameters:
  • dataset (str) – Name of the semantic model.

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

  • extended (bool, default=False) – If True, adds an extra column called ‘Valid Semantic Model Object’ which identifies whether the semantic model object used in the report exists in the semantic model which feeds data to the report.

Returns:

  • pandas.DataFrame – A pandas dataframe showing a list of semantic model objects (i.e. columns, measures, hierarchies) used in all reports which feed data from

  • a given semantic model.

sempy_labs.list_reports_using_semantic_model(dataset: str, workspace: str | None = None) DataFrame

Shows a list of all the reports (in all workspaces) which use a given semantic model.

Parameters:
  • dataset (str) – Name of the semantic model.

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

A pandas dataframe showing the reports which use a given semantic model.

Return type:

pandas.DataFrame

sempy_labs.list_semantic_model_object_report_usage(dataset: str, workspace: str | None = None, include_dependencies: bool = False, extended: bool = False) DataFrame

Shows a list of semantic model objects and how many times they are referenced in all reports which rely on this semantic model.

Requirement: Reports must be in the PBIR format.

Parameters:
  • dataset (str) – Name of the semantic model.

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

  • include_dependencies (bool, default=False) – If True, includes measure dependencies.

  • extended (bool, default=False) – If True, adds columns ‘Total Size’, ‘Data Size’, ‘Dictionary Size’, ‘Hierarchy Size’ based on Vertipaq statistics.

Returns:

A pandas dataframe showing a list of semantic model objects and how many times they are referenced in all reports which rely on this semantic model. By default, the dataframe is sorted descending by ‘Report Usage Count’.

Return type:

pandas.DataFrame

sempy_labs.list_semantic_model_objects(dataset: str, workspace: str | None = None) DataFrame

Shows a list of semantic model objects.

Parameters:
  • dataset (str) – Name of the semantic model.

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

A pandas dataframe showing a list of objects in the semantic model

Return type:

pandas.DataFrame

sempy_labs.list_shortcuts(lakehouse: str | None = None, workspace: str | None = None) DataFrame

Shows all shortcuts which exist in a Fabric lakehouse and their properties.

Parameters:
  • lakehouse (str, default=None) – The Fabric lakehouse name. Defaults to None which resolves to the lakehouse attached to the notebook.

  • workspace (str, default=None) – The name of the Fabric workspace in which lakehouse resides. 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 all the shortcuts which exist in the specified lakehouse.

Return type:

pandas.DataFrame

sempy_labs.list_sql_endpoints(workspace: str | None = None) DataFrame

Shows the SQL endpoints within a workspace.

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:

A pandas dataframe showing the SQL endpoints within a workspace.

Return type:

pandas.DataFrame

sempy_labs.list_storage_account_files(storage_account: str, container: str = 'power-bi-backup') DataFrame

Shows a list of files within an ADLS Gen2 storage account.

Parameters:
  • storage_account (str) – The name of the ADLS Gen2 storage account.

  • container (str, default='power-bi-backup') – The name of the container.

Returns:

A pandas dataframe showing a list of files contained within an ADLS Gen2 storage account.

Return type:

pandas.DataFrame

sempy_labs.list_warehouses(workspace: str | None = None) DataFrame

Shows the warehouses within a workspace.

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:

A pandas dataframe showing the warehouses within a workspace.

Return type:

pandas.DataFrame

sempy_labs.list_workspace_role_assignments(workspace: str | None = None) DataFrame

Shows the members of a given workspace.

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:

A pandas dataframe showing the members of a given workspace and their roles.

Return type:

pandas.DataFrame

sempy_labs.list_workspace_users(workspace: str | None = None) DataFrame

A list of all the users of a workspace and their roles.

Parameters:

workspace (str, default=None) – The name of the workspace. 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 the users of a workspace and their properties.

Return type:

pandas.DataFrame

sempy_labs.measure_dependency_tree(dataset: str, measure_name: str, workspace: str | None = None)

Prints a measure dependency tree of all dependent objects for a measure in a semantic model.

Parameters:
  • dataset (str) – Name of the semantic model.

  • measure_name (str) – Name of the measure.

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

sempy_labs.migrate_access_settings(source_capacity: str, target_capacity: str)

This function migrates the access settings from a source capacity to a target capacity.

Parameters:
  • source_capacity (str) – Name of the source capacity.

  • target_capacity (str) – Name of the target capacity.

sempy_labs.migrate_capacities(azure_subscription_id: str, key_vault_uri: str, key_vault_tenant_id: str, key_vault_client_id: str, key_vault_client_secret: str, resource_group: str | dict, capacities: str | List[str] | None = None, use_existing_rg_for_A_sku: bool = True, p_sku_only: bool = True)

This function creates new Fabric capacities for given A or P sku capacities and reassigns their workspaces to the newly created capacity.

Parameters:
  • azure_subscription_id (str) – The Azure subscription ID.

  • key_vault_uri (str) –

    The name of the Azure key vault URI. Example: “https://<Key Vault Name>.vault.azure.net/”

  • key_vault_tenant_id (str) – The name of the Azure key vault secret storing the Tenant ID.

  • key_vault_client_id (str) – The name of the Azure key vault secret storing the Client ID.

  • key_vault_client_secret (str) – The name of the Azure key vault secret storing the Client Secret.

  • resource_group (str | dict) – The name of the Azure resource group. For A skus, this parameter will be ignored and the resource group used for the F sku will be the same as the A sku’s resource group. For P skus, if this parameter is a string, it will use that resource group for all of the newly created F skus. If this parameter is a dictionary, it will use that mapping (capacity name -> resource group) for creating capacities with the mapped resource groups.

  • capacities (str | List[str], default=None) – The capacity(ies) to migrate from A/P -> F sku. Defaults to None which migrates all accessible A/P sku capacities to F skus.

  • use_existing_rg_for_A_sku (bool, default=True) – If True, the F sku inherits the resource group from the A sku (for A sku migrations)

  • p_sku_only (bool, default=True) – If set to True, only migrates P skus. If set to False, migrates both P and A skus.

sempy_labs.migrate_capacity_settings(source_capacity: str, target_capacity: str)

This function migrates a capacity’s settings to another capacity.

Parameters:
  • source_capacity (str) – Name of the source capacity.

  • target_capacity (str) – Name of the target capacity.

sempy_labs.migrate_delegated_tenant_settings(source_capacity: str, target_capacity: str)

This function migrates the delegated tenant settings from a source capacity to a target capacity.

Parameters:
  • source_capacity (str) – Name of the source capacity.

  • target_capacity (str) – Name of the target capacity.

sempy_labs.migrate_disaster_recovery_settings(source_capacity: str, target_capacity: str)

This function migrates a capacity’s disaster recovery settings to another capacity.

Parameters:
  • source_capacity (str) – Name of the source capacity.

  • target_capacity (str) – Name of the target capacity.

sempy_labs.migrate_fabric_trial_capacity(azure_subscription_id: str, key_vault_uri: str, key_vault_tenant_id: str, key_vault_client_id: str, key_vault_client_secret: str, resource_group: str, source_capacity: str, target_capacity: str, target_capacity_sku: str = 'F64', target_capacity_region: str | None = None, target_capacity_admin_members: str | List[str] | None = None)

This function migrates a Fabric trial capacity to a Fabric capacity. If the ‘target_capacity’ does not exist, it is created with the relevant target capacity parameters (sku, region, admin members).

Parameters:
  • azure_subscription_id (str) – The Azure subscription ID.

  • key_vault_uri (str) –

    The name of the Azure key vault URI. Example: “https://<Key Vault Name>.vault.azure.net/”

  • key_vault_tenant_id (str) – The name of the Azure key vault secret storing the Tenant ID.

  • key_vault_client_id (str) – The name of the Azure key vault secret storing the Client ID.

  • key_vault_client_secret (str) – The name of the Azure key vault secret storing the Client Secret.

  • resource_group (str) – The name of the Azure resource group.

  • source_capacity (str) – The name of the Fabric trial capacity.

  • target_capacity (str) – The name of the new Fabric capacity (F SKU). If this capacity does not exist, it will be created.

  • target_capacity_sku (str, default="F64") – If the target capacity does not exist, this property sets the SKU size for the target capacity.

  • target_capacity_region (str, default=None) – If the target capacity does not exist, this property sets the region for the target capacity. Defaults to None which resolves to the region in which the Trial SKU exists.

  • target_capacity_admin_members (str, default=None) – If the target capacity does not exist, this property sets the admin members for the target capacity. Defaults to None which resolves to the admin members on the Trial SKU.

sempy_labs.migrate_notification_settings(source_capacity: str, target_capacity: str)

This function migrates the notification settings from a source capacity to a target capacity.

Parameters:
  • source_capacity (str) – Name of the source capacity.

  • target_capacity (str) – Name of the target capacity.

sempy_labs.migrate_spark_settings(source_capacity: str, target_capacity: str)

This function migrates a capacity’s spark settings to another capacity.

Requirement: The target capacity must be able to accomodate the spark pools being migrated from the source capacity.

Parameters:
  • source_capacity (str) – Name of the source capacity.

  • target_capacity (str) – Name of the target capacity.

sempy_labs.migrate_workspaces(source_capacity: str, target_capacity: str, workspaces: str | List[str] | None = None)

This function migrates the workspace(s) from one capacity to another capacity. Limitation: source & target capacities must be in the same region. If not all the workspaces succesfully migrated to the target capacity, the migrated workspaces will rollback to be assigned to the source capacity.

Parameters:
  • source_capacity (str) – Name of the source Fabric capacity.

  • target_capacity (str) – Name of the target/destination Fabric capacity.

  • workspaces (str | List[str], default=None) – The name of the workspace(s) specified will be reassigned from the source capacity to the target capacity. Defaults to None which will reassign all workspaces in the source capacity to the target capacity.

sempy_labs.model_bpa_rules(dependencies: DataFrame | None = None, **kwargs) DataFrame

Shows the default rules for the semantic model BPA used by the run_model_bpa function.

Parameters:

dependencies (pd.DataFrame, default=None) – A pandas dataframe with the output of the ‘get_model_calc_dependencies’ function.

Returns:

A pandas dataframe containing the default rules for the run_model_bpa function.

Return type:

pandas.DataFrame

sempy_labs.provision_workspace_identity(workspace: str | None = None)

Provisions a workspace identity for a workspace.

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.

sempy_labs.publish_environment(environment: str, workspace: str | None = None)

Publishes a Fabric environment.

Parameters:
  • environment (str) – Name of the environment.

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

sempy_labs.qso_sync(dataset: str, workspace: str | None = None)

Triggers a query scale-out sync of read-only replicas for the specified dataset from the specified workspace.

Parameters:
  • dataset (str) – Name of the semantic model.

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

sempy_labs.qso_sync_status(dataset: str, workspace: str | None = None) Tuple[DataFrame, DataFrame]

Returns the query scale-out sync status for the specified dataset from the specified workspace.

Parameters:
  • dataset (str) – Name of the semantic model.

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

2 pandas dataframes showing the query scale-out sync status.

Return type:

Tuple[pandas.DataFrame, pandas.DataFrame]

sempy_labs.refresh_semantic_model(dataset: str, tables: str | List[str] | None = None, partitions: str | List[str] | None = None, refresh_type: str = 'full', retry_count: int = 0, apply_refresh_policy: bool = True, max_parallelism: int = 10, workspace: str | None = None)

Refreshes a semantic model.

Parameters:
  • dataset (str) – Name of the semantic model.

  • tables (str, List[str], default=None) – A string or a list of tables to refresh.

  • partitions (str, List[str], default=None) – A string or a list of partitions to refresh. Partitions must be formatted as such: ‘Table Name’[Partition Name].

  • refresh_type (str, default="full") – The type of processing to perform. Types align with the TMSL refresh command types: full, clearValues, calculate, dataOnly, automatic, and defragment. The add type isn’t supported. Defaults to “full”.

  • retry_count (int, default=0) – Number of times the operation retries before failing.

  • apply_refresh_policy (bool, default=True) – If an incremental refresh policy is defined, determines whether to apply the policy. Modes are true or false. If the policy isn’t applied, the full process leaves partition definitions unchanged, and fully refreshes all partitions in the table. If commitMode is transactional, applyRefreshPolicy can be true or false. If commitMode is partialBatch, applyRefreshPolicy of true isn’t supported, and applyRefreshPolicy must be set to false.

  • max_parallelism (int, default=10) – Determines the maximum number of threads that can run the processing commands in parallel. This value aligns with the MaxParallelism property that can be set in the TMSL Sequence command or by using other methods. Defaults to 10.

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

sempy_labs.resolve_capacity_id(capacity_name: str | None = None) UUID

Obtains the capacity Id for a given capacity name.

Parameters:

capacity_name (str, default=None) – The capacity name. Defaults to None which resolves to the capacity id of the workspace of the attached lakehouse or if no lakehouse attached, resolves to the capacity name of the workspace of the notebook.

Returns:

The capacity Id.

Return type:

UUID

sempy_labs.resolve_capacity_name(capacity_id: UUID | None = None) str

Obtains the capacity name for a given capacity Id.

Parameters:

capacity_id (UUID, default=None) – The capacity Id. Defaults to None which resolves to the capacity name of the workspace of the attached lakehouse or if no lakehouse attached, resolves to the capacity name of the workspace of the notebook.

Returns:

The capacity name.

Return type:

str

sempy_labs.resolve_dataset_from_report(report: str, workspace: str | None = None) Tuple[UUID, str, UUID, str]

Obtains the basic semantic model properties from which the report’s data is sourced.

Parameters:
  • report (str) – The name of the Power BI report.

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

The semantic model UUID, semantic model name, semantic model workspace UUID, semantic model workspace name

Return type:

Tuple[UUID, str, UUID, str]

sempy_labs.resolve_dataset_id(dataset: str, workspace: str | None = None) UUID

Obtains the ID of the semantic model.

Parameters:
  • dataset (str) – The name of the semantic model.

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

The ID of the semantic model.

Return type:

UUID

sempy_labs.resolve_dataset_name(dataset_id: UUID, workspace: str | None = None) str

Obtains the name of the semantic model.

Parameters:
  • dataset_id (UUID) – The name of the semantic model.

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

The name of the semantic model.

Return type:

str

sempy_labs.resolve_environment_id(environment: str, workspace: str | None = None) UUID

Obtains the environment Id for a given environment.

Parameters:

environment (str) – Name of the environment.

Returns:

The environment Id.

Return type:

UUID

sempy_labs.resolve_item_type(item_id: UUID, workspace: str | None = None) str

Obtains the item type for a given Fabric Item Id within a Fabric workspace.

Parameters:
  • item_id (UUID) – The item/artifact Id.

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

The item type for the item Id.

Return type:

str

sempy_labs.resolve_lakehouse_id(lakehouse: str, workspace: str | None = None) UUID

Obtains the ID of the Fabric lakehouse.

Parameters:
  • lakehouse (str) – The name of the Fabric lakehouse.

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

The ID of the Fabric lakehouse.

Return type:

UUID

sempy_labs.resolve_lakehouse_name(lakehouse_id: UUID | None = None, workspace: str | None = None) str

Obtains the name of the Fabric lakehouse.

Parameters:
  • lakehouse_id (UUID, default=None) – The name of the Fabric lakehouse. Defaults to None which resolves to the lakehouse attached to the notebook.

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

The name of the Fabric lakehouse.

Return type:

str

sempy_labs.resolve_report_id(report: str, workspace: str | None = None) UUID

Obtains the ID of the Power BI report.

Parameters:
  • report (str) – The name of the Power BI report.

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

The ID of the Power BI report.

Return type:

UUID

sempy_labs.resolve_report_name(report_id: UUID, workspace: str | None = None) str

Obtains the name of the Power BI report.

Parameters:
  • report_id (UUID) – The name of the Power BI report.

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

The name of the Power BI report.

Return type:

str

sempy_labs.resolve_warehouse_id(warehouse: str, workspace: str | None) UUID

Obtains the Id for a given warehouse.

Parameters:

warehouse (str) – The warehouse name

Returns:

The warehouse Id.

Return type:

UUID

sempy_labs.resolve_workspace_capacity(workspace: str | None = None) Tuple[UUID, str]

Obtains the capacity Id and capacity name for a given workspace.

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:

capacity Id; capacity came.

Return type:

Tuple[UUID, str]

sempy_labs.restore_semantic_model(dataset: str, file_path: str, allow_overwrite: bool = True, ignore_incompatibilities: bool = True, force_restore: bool = False, workspace: str | None = None)

Restores a semantic model based on a backup (.abf) file within the ADLS Gen2 storage account connected to the workspace.

Parameters:
  • dataset (str) – Name of the semantic model.

  • file_path (str) – The location in which to backup the semantic model. Must end in ‘.abf’. Example 1: file_path = ‘MyModel.abf’ Example 2: file_path = ‘MyFolder/MyModel.abf’

  • allow_overwrite (bool, default=True) – If True, overwrites backup files of the same name. If False, the file you are saving cannot have the same name as a file that already exists in the same location.

  • ignore_incompatibilities (bool, default=True) – If True, ignores incompatibilities between Azure Analysis Services and Power BI Premium.

  • force_restore (bool, default=False) – If True, restores the semantic model with the existing semantic model unloaded and offline.

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

sempy_labs.resume_fabric_capacity(capacity_name: str, azure_subscription_id: str, resource_group: str, key_vault_uri: str, key_vault_tenant_id: str, key_vault_client_id: str, key_vault_client_secret: str)

This function resumes a Fabric capacity.

Parameters:
  • capacity_name (str) – Name of the Fabric capacity.

  • azure_subscription_id (str) – The Azure subscription ID.

  • resource_group (str) – The name of the Azure resource group.

  • key_vault_uri (str) –

    The name of the Azure key vault URI. Example: “https://<Key Vault Name>.vault.azure.net/”

  • key_vault_tenant_id (str) – The name of the Azure key vault secret storing the Tenant ID.

  • key_vault_client_id (str) – The name of the Azure key vault secret storing the Client ID.

  • key_vault_client_secret (str) – The name of the Azure key vault secret storing the Client Secret.

sempy_labs.revoke_external_data_share(external_data_share_id: UUID, item_name: str, item_type: str, workspace: str | None = None)

Revokes the specified external data share. Note: This action cannot be undone.

Parameters:
  • external_data_share_id (UUID) – The external data share ID.

  • item_name (str) – The item name.

  • item_type (str) –

    The item type.

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

sempy_labs.run_model_bpa(dataset: str, rules: DataFrame | None = None, workspace: str | None = None, export: bool = False, return_dataframe: bool = False, extended: bool = False, language: str | None = None, **kwargs)

Displays an HTML visualization of the results of the Best Practice Analyzer scan for a semantic model.

Parameters:
  • dataset (str) – Name of the semantic model.

  • rules (pandas.DataFrame, default=None) – A pandas dataframe containing rules to be evaluated.

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

  • export (bool, default=False) – If True, exports the resulting dataframe to a delta table in the lakehouse attached to the notebook.

  • return_dataframe (bool, default=False) – If True, returns a pandas dataframe instead of the visualization.

  • extended (bool, default=False) – If True, runs the set_vertipaq_annotations function to collect Vertipaq Analyzer statistics to be used in the analysis of the semantic model.

  • language (str, default=None) – Specifying a language code (i.e. ‘it-IT’ for Italian) will auto-translate the Category, Rule Name and Description into the specified language. Defaults to None which resolves to English.

Returns:

A pandas dataframe in HTML format showing semantic model objects which violated the best practice analyzer rules.

Return type:

pandas.DataFrame

sempy_labs.run_model_bpa_bulk(rules: DataFrame | None = None, extended: bool = False, language: str | None = None, workspace: str | List[str] | None = None, skip_models: str | List[str] | None = ['ModelBPA', 'Fabric Capacity Metrics'])

Runs the semantic model Best Practice Analyzer across all semantic models in a workspace (or all accessible workspaces). Saves (appends) the results to the ‘modelbparesults’ delta table in the lakehouse attached to the notebook. Default semantic models are skipped in this analysis.

Parameters:
  • dataset (str) – Name of the semantic model.

  • rules (pandas.DataFrame, default=None) – A pandas dataframe containing rules to be evaluated. Based on the format of the dataframe produced by the model_bpa_rules function.

  • extended (bool, default=False) – If True, runs the set_vertipaq_annotations function to collect Vertipaq Analyzer statistics to be used in the analysis of the semantic model.

  • language (str, default=None) – The language (code) in which the rules will appear. For example, specifying ‘it-IT’ will show the Rule Name, Category and Description in Italian. Defaults to None which resolves to English.

  • workspace (str | List[str], default=None) – The workspace or list of workspaces to scan. Defaults to None which scans all accessible workspaces.

  • skip_models (str | List[str], default=['ModelBPA', 'Fabric Capacity Metrics']) – The semantic models to always skip when running this analysis.

sempy_labs.save_as_delta_table(dataframe, delta_table_name: str, write_mode: str, merge_schema: bool = False, schema: dict | None = None, lakehouse: str | None = None, workspace: str | None = None)

Saves a pandas dataframe as a delta table in a Fabric lakehouse.

Parameters:
  • dataframe (pandas.DataFrame) – The dataframe to be saved as a delta table.

  • delta_table_name (str) – The name of the delta table.

  • write_mode (str) – The write mode for the save operation. Options: ‘append’, ‘overwrite’.

  • merge_schema (bool, default=False) – Merges the schemas of the dataframe to the delta table.

  • schema (dict, default=None) – A dictionary showing the schema of the columns and their data types.

  • lakehouse (str, default=None) – The Fabric lakehouse used by the Direct Lake semantic model. Defaults to None which resolves to the lakehouse attached to the notebook.

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

sempy_labs.set_qso(dataset: str, auto_sync: bool = True, max_read_only_replicas: int = -1, workspace: str | None = None) DataFrame

Sets the query scale out settings for a semantic model.

Parameters:
  • dataset (str) – Name of the semantic model.

  • auto_sync (bool, default=True) – Whether the semantic model automatically syncs read-only replicas.

  • max_read_only_replicas (int, default=-1) – To enable semantic model scale-out, set max_read_only_replicas to -1, or any non-0 value. A value of -1 allows Power BI to create as many read-only replicas as your Power BI capacity supports. You can also explicitly set the replica count to a value lower than that of the capacity maximum. Setting max_read_only_replicas to -1 is recommended.

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

A pandas dataframe showing the current query scale-out settings.

Return type:

pandas.DataFrame

sempy_labs.set_semantic_model_storage_format(dataset: str, storage_format: str, workspace: str | None = None)

Sets the semantic model storage format.

Parameters:
  • dataset (str) – Name of the semantic model.

  • storage_format (str) – The storage format for the semantic model. Valid options: ‘Large’, ‘Small’.

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

sempy_labs.set_workspace_default_storage_format(storage_format: str, workspace: str | None = None)

Sets the default storage format for semantic models within a workspace.

Parameters:
  • storage_format (str) – The storage format for the semantic model. Valid options: ‘Large’, ‘Small’.

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

sempy_labs.suspend_fabric_capacity(capacity_name: str, azure_subscription_id: str, resource_group: str, key_vault_uri: str, key_vault_tenant_id: str, key_vault_client_id: str, key_vault_client_secret: str)

This function suspends a Fabric capacity.

Parameters:
  • capacity_name (str) – Name of the Fabric capacity.

  • azure_subscription_id (str) – The Azure subscription ID.

  • resource_group (str) – The name of the Azure resource group.

  • key_vault_uri (str) –

    The name of the Azure key vault URI. Example: “https://<Key Vault Name>.vault.azure.net/”

  • key_vault_tenant_id (str) – The name of the Azure key vault secret storing the Tenant ID.

  • key_vault_client_id (str) – The name of the Azure key vault secret storing the Client ID.

  • key_vault_client_secret (str) – The name of the Azure key vault secret storing the Client Secret.

sempy_labs.translate_semantic_model(dataset: str, languages: str | List[str], exclude_characters: str | None = None, workspace: str | None = None) DataFrame

Translates names, descriptions, display folders for all objects in a semantic model.

Parameters:
  • dataset (str) – Name of the semantic model.

  • languages (str, List[str]) – The language code(s) in which to translate the semantic model.

  • exclude_characters (str) – A string specifying characters which will be replaced by a space in the translation text when sent to the translation service.

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

Shows a pandas dataframe which displays all of the translations in the semantic model.

Return type:

pandas.DataFrame

sempy_labs.unassign_workspace_from_capacity(workspace: str | None = None)

Unassigns a workspace from its assigned capacity.

Parameters:

workspace (str, default=None) – The name of the Fabric workspace. 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.update_custom_pool(pool_name: str, node_size: str | None = None, min_node_count: int | None = None, max_node_count: int | None = None, min_executors: int | None = None, max_executors: int | None = None, node_family: str | None = None, auto_scale_enabled: bool | None = None, dynamic_executor_allocation_enabled: bool | None = None, workspace: str | None = None)

Updates the properties of a custom pool within a workspace.

Parameters:
  • pool_name (str) – The custom pool name.

  • node_size (str, default=None) –

    The node size. Defaults to None which keeps the existing property setting.

  • min_node_count (int, default=None) –

    The minimum node count. Defaults to None which keeps the existing property setting.

  • max_node_count (int, default=None) – The maximum node count. Defaults to None which keeps the existing property setting.

  • min_executors (int, default=None) –

    The minimum executors. Defaults to None which keeps the existing property setting.

  • max_executors (int, default=None) – The maximum executors. Defaults to None which keeps the existing property setting.

  • node_family (str, default=None) –

    The node family. Defaults to None which keeps the existing property setting.

  • auto_scale_enabled (bool, default=None) –

    The status of auto scale. Defaults to None which keeps the existing property setting.

  • dynamic_executor_allocation_enabled (bool, default=None) –

    The status of the dynamic executor allocation. Defaults to None which keeps the existing property setting.

  • workspace (str, default=None) – The name of the Fabric workspace. 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.update_fabric_capacity(capacity_name: str, azure_subscription_id: str, resource_group: str, key_vault_uri: str, key_vault_tenant_id: str, key_vault_client_id: str, key_vault_client_secret: str, sku: str | None = None, admin_members: str | List[str] | None = None, tags: dict | None = None)

This function updates a Fabric capacity’s properties.

Parameters:
  • capacity_name (str) – Name of the Fabric capacity.

  • azure_subscription_id (str) – The Azure subscription ID.

  • resource_group (str) – The name of the Azure resource group.

  • key_vault_uri (str) –

    The name of the Azure key vault URI. Example: “https://<Key Vault Name>.vault.azure.net/”

  • key_vault_tenant_id (str) – The name of the Azure key vault secret storing the Tenant ID.

  • key_vault_client_id (str) – The name of the Azure key vault secret storing the Client ID.

  • key_vault_client_secret (str) – The name of the Azure key vault secret storing the Client Secret.

  • sku (str, default=None) –

    The sku size of the Fabric capacity.

  • admin_members (str | List[str], default=None) – The email address(es) of the admin(s) of the Fabric capacity.

  • tags (dict, default=None) – Tag(s) to add to the capacity. Example: {‘tagName’: ‘tagValue’}.

sempy_labs.update_from_git(remote_commit_hash: str, conflict_resolution_policy: str, workspace_head: str | None = None, allow_override: bool = False, workspace: str | None = None)

Updates the workspace with commits pushed to the connected branch.

Parameters:
  • workspace_head (str) – Full SHA hash that the workspace is synced to. This value may be null only after Initialize Connection. In other cases, the system will validate that the given value is aligned with the head known to the system.

  • remove_commit_hash (str) – Remote full SHA commit hash.

  • confilict_resolution_policy (str) – The conflict resolution policy.

  • allow_override (bool, default=False)

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

sempy_labs.update_item(item_type: str, current_name: str, new_name: str, description: str | None = None, workspace: str | None = None)

Updates the name/description of a Fabric item.

Parameters:
  • item_type (str) – Type of item to update.

  • current_name (str) – The current name of the item.

  • new_name (str) – The new name of the item.

  • description (str, default=None) – A description of the item.

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

sempy_labs.update_semantic_model_from_bim(dataset: str, bim_file: dict, workspace: str | None = None)

Updates a semantic model definition based on a Model.bim file.

Parameters:
  • dataset (str) – Name of the semantic model.

  • bim_file (dict) – The model.bim file.

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

sempy_labs.update_spark_settings(automatic_log_enabled: bool | None = None, high_concurrency_enabled: bool | None = None, customize_compute_enabled: bool | None = None, default_pool_name: str | None = None, max_node_count: int | None = None, max_executors: int | None = None, environment_name: str | None = None, runtime_version: str | None = None, workspace: str | None = None)

Updates the spark settings for a workspace.

Parameters:
  • automatic_log_enabled (bool, default=None) – The status of the automatic log. Defaults to None which keeps the existing property setting.

  • high_concurrency_enabled (bool, default=None) – The status of the high concurrency for notebook interactive run. Defaults to None which keeps the existing property setting.

  • customize_compute_enabled (bool, default=None) – Customize compute configurations for items. Defaults to None which keeps the existing property setting.

  • default_pool_name (str, default=None) – Default pool for workspace. Defaults to None which keeps the existing property setting.

  • max_node_count (int, default=None) – The maximum node count. Defaults to None which keeps the existing property setting.

  • max_executors (int, default=None) – The maximum executors. Defaults to None which keeps the existing property setting.

  • environment_name (str, default=None) – The name of the default environment. Empty string indicated there is no workspace default environment Defaults to None which keeps the existing property setting.

  • runtime_version (str, default=None) – The runtime version. Defaults to None which keeps the existing property setting.

  • workspace (str, default=None) – The name of the Fabric workspace. 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.update_workspace_user(email_address: str, role_name: str, principal_type: str | None = 'User', workspace: str | None = None)

Updates a user’s role within a workspace.

Parameters:
  • email_address (str) – The email address of the user.

  • role_name (str) –

    The role of the user within the workspace.

  • principal_type (str, default='User') –

    The principal type.

  • workspace (str, default=None) – The name of the workspace. 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.vertipaq_analyzer(dataset: str, workspace: str | None = None, export: str | None = None, read_stats_from_data: bool = False, **kwargs)

Displays an HTML visualization of the Vertipaq Analyzer statistics from a semantic model.

Parameters:
  • dataset (str) – Name of the semantic model.

  • workspace (str, default=None) – The Fabric workspace name in which the semantic model exists. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

  • export (str, default=None) – Specifying ‘zip’ will export the results to a zip file in your lakehouse (which can be imported using the import_vertipaq_analyzer function. Specifying ‘table’ will export the results to delta tables (appended) in your lakehouse. Default value: None.

  • read_stats_from_data (bool, default=False) – Setting this parameter to true has the function get Column Cardinality and Missing Rows using DAX (Direct Lake semantic models achieve this using a Spark query to the lakehouse).