sempy_labs package
Subpackages
- sempy_labs.admin package
- Module contents
assign_domain_workspaces()assign_domain_workspaces_by_capacities()assign_workspaces_to_capacity()create_domain()delete_domain()list_access_entities()list_activity_events()list_capacities()list_capacities_delegated_tenant_settings()list_datasets()list_domain_workspaces()list_domains()list_external_data_shares()list_item_access_details()list_items()list_modified_workspaces()list_tenant_settings()list_workspace_access_details()list_workspaces()resolve_domain_id()revoke_external_data_share()unassign_all_domain_workspaces()unassign_domain_workspaces()unassign_workspaces_from_capacity()update_domain()
- Module contents
- sempy_labs.directlake package
- Module contents
add_table_to_direct_lake_semantic_model()check_fallback_reason()direct_lake_schema_compare()direct_lake_schema_sync()generate_direct_lake_semantic_model()generate_shared_expression()get_direct_lake_guardrails()get_direct_lake_lakehouse()get_direct_lake_source()get_directlake_guardrails_for_sku()get_shared_expression()get_sku_size()list_direct_lake_model_calc_tables()show_unsupported_direct_lake_objects()update_direct_lake_model_connection()update_direct_lake_model_lakehouse_connection()update_direct_lake_partition_entity()warm_direct_lake_cache_isresident()warm_direct_lake_cache_perspective()
- Module contents
- sempy_labs.lakehouse package
- sempy_labs.migration package
- sempy_labs.report package
- Module contents
ReportWrapperReportWrapper.disable_show_items_with_no_data()ReportWrapper.get_theme()ReportWrapper.hide_tooltip_drillthrough_pages()ReportWrapper.list_bookmarks()ReportWrapper.list_custom_visuals()ReportWrapper.list_page_filters()ReportWrapper.list_pages()ReportWrapper.list_report_filters()ReportWrapper.list_report_level_measures()ReportWrapper.list_semantic_model_objects()ReportWrapper.list_visual_filters()ReportWrapper.list_visual_interactions()ReportWrapper.list_visual_objects()ReportWrapper.list_visuals()ReportWrapper.migrate_report_level_measures()ReportWrapper.remove_unnecessary_custom_visuals()ReportWrapper.resolve_page_display_name()ReportWrapper.resolve_page_name()ReportWrapper.set_active_page()ReportWrapper.set_page_type()ReportWrapper.set_page_visibility()ReportWrapper.set_theme()ReportWrapper.update_report()
clone_report()create_model_bpa_report()create_report_from_reportjson()download_report()export_report()get_report_datasources()get_report_definition()get_report_json()launch_report()report_bpa_rules()report_rebind()report_rebind_all()run_report_bpa()update_report_from_reportjson()
- Module contents
- sempy_labs.tom package
- Module contents
TOMWrapperTOMWrapper.add_calculated_column()TOMWrapper.add_calculated_table()TOMWrapper.add_calculated_table_column()TOMWrapper.add_calculation_group()TOMWrapper.add_calculation_item()TOMWrapper.add_changed_property()TOMWrapper.add_data_column()TOMWrapper.add_entity_partition()TOMWrapper.add_expression()TOMWrapper.add_field_parameter()TOMWrapper.add_hierarchy()TOMWrapper.add_incremental_refresh_policy()TOMWrapper.add_m_partition()TOMWrapper.add_measure()TOMWrapper.add_perspective()TOMWrapper.add_relationship()TOMWrapper.add_role()TOMWrapper.add_table()TOMWrapper.add_time_intelligence()TOMWrapper.add_to_perspective()TOMWrapper.add_translation()TOMWrapper.all_calculated_columns()TOMWrapper.all_calculated_tables()TOMWrapper.all_calculation_groups()TOMWrapper.all_calculation_items()TOMWrapper.all_columns()TOMWrapper.all_date_tables()TOMWrapper.all_hierarchies()TOMWrapper.all_hybrid_tables()TOMWrapper.all_levels()TOMWrapper.all_measures()TOMWrapper.all_partitions()TOMWrapper.all_rls()TOMWrapper.apply_refresh_policy()TOMWrapper.cardinality()TOMWrapper.clear_annotations()TOMWrapper.clear_extended_properties()TOMWrapper.close()TOMWrapper.data_size()TOMWrapper.depends_on()TOMWrapper.dictionary_size()TOMWrapper.fully_qualified_measures()TOMWrapper.generate_measure_descriptions()TOMWrapper.get_annotation_value()TOMWrapper.get_annotations()TOMWrapper.get_extended_properties()TOMWrapper.get_extended_property_value()TOMWrapper.has_aggs()TOMWrapper.has_date_table()TOMWrapper.has_hybrid_table()TOMWrapper.has_incremental_refresh_policy()TOMWrapper.in_perspective()TOMWrapper.is_agg_table()TOMWrapper.is_auto_date_table()TOMWrapper.is_calculated_column()TOMWrapper.is_calculated_table()TOMWrapper.is_date_table()TOMWrapper.is_direct_lake()TOMWrapper.is_direct_lake_using_view()TOMWrapper.is_field_parameter()TOMWrapper.is_hybrid_table()TOMWrapper.mark_as_date_table()TOMWrapper.records_per_segment()TOMWrapper.referenced_by()TOMWrapper.remove_alternate_of()TOMWrapper.remove_annotation()TOMWrapper.remove_changed_property()TOMWrapper.remove_extended_property()TOMWrapper.remove_from_perspective()TOMWrapper.remove_object()TOMWrapper.remove_sort_by_column()TOMWrapper.remove_translation()TOMWrapper.remove_vertipaq_annotations()TOMWrapper.row_count()TOMWrapper.set_aggregations()TOMWrapper.set_alternate_of()TOMWrapper.set_annotation()TOMWrapper.set_data_coverage_definition()TOMWrapper.set_data_type()TOMWrapper.set_direct_lake_behavior()TOMWrapper.set_encoding_hint()TOMWrapper.set_extended_property()TOMWrapper.set_is_available_in_mdx()TOMWrapper.set_kpi()TOMWrapper.set_ols()TOMWrapper.set_rls()TOMWrapper.set_sort_by_column()TOMWrapper.set_summarize_by()TOMWrapper.set_translation()TOMWrapper.set_value_filter_behavior()TOMWrapper.set_vertipaq_annotations()TOMWrapper.show_incremental_refresh_policy()TOMWrapper.total_size()TOMWrapper.unqualified_columns()TOMWrapper.update_calculation_item()TOMWrapper.update_column()TOMWrapper.update_incremental_refresh_policy()TOMWrapper.update_lineage_tags()TOMWrapper.update_m_partition()TOMWrapper.update_measure()TOMWrapper.update_role()TOMWrapper.used_in_calc_item()TOMWrapper.used_in_data_coverage_definition()TOMWrapper.used_in_hierarchies()TOMWrapper.used_in_levels()TOMWrapper.used_in_relationships()TOMWrapper.used_in_rls()TOMWrapper.used_in_sort_by()TOMWrapper.used_size()
connect_semantic_model()
- Module contents
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.
This is a wrapper function for the following API: Groups - Add Group User.
- 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.
This is a wrapper function for the following API: Workspaces - Assign To Capacity.
- sempy_labs.assign_workspace_to_dataflow_storage(dataflow_storage_account: str, workspace: str | None = None)
Assigns a dataflow storage account to a workspace.
This is a wrapper function for the following API: Dataflow Storage Accounts - Groups AssignToDataflowStorage.
- 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.
This is a wrapper function for the following API: Fabric Capacities - Check Name Availability.
- 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:
- sempy_labs.clear_cache(dataset: str, workspace: str | None = None)
Clears the cache of a semantic model. See here for documentation.
- 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.
This is a wrapper function for the following API: Git - Commit 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.
This is a wrapper function for the following API: Git - Connect.
- 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.
- 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:
Must have an Azure storage account and connect it to both the source and target workspace.
- Must be a ‘Storage Blob Data Contributor’ for the storage account.
- Steps:
Navigate to the storage account within the Azure Portal
Navigate to ‘Access Control (IAM)’
Click ‘+ Add’ -> Add Role Assignment
Search for ‘Storage Blob Data Contributor’, select it and click ‘Next’
Add yourself as a member, click ‘Next’
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.
- 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.
This is a wrapper function for the following API: Custom Pools - Create Workspace Custom Pool.
- Parameters:
pool_name (str) – The custom pool name.
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.
This is a wrapper function for the following API: Items - Create 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.
This is a wrapper function for the following API: Items - Create 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.
This is a wrapper function for the following API: Items - Create 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.
This is a wrapper function for the following API: Items - Create 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.
Creates an external data share for a given path or list of paths in the specified item.
This is a wrapper function for the following API: External Data Shares - Create External Data Share.
- Parameters:
item_name (str) – The item name.
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.
This is a wrapper function for the following API: Fabric Capacities - Create Or Update.
- 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.
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.
This is a wrapper function for the following API: Items - Create 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.
This is a wrapper function for the following API: Items - Create 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_managed_private_endpoint(name: str, target_private_link_resource_id: UUID, target_subresource_type: str, request_message: str | None = None, workspace: str | None = None)
Creates a managed private endpoint.
This is a wrapper function for the following API: Managed Private Endpoints - Create Workspace Managed Private Endpoint <https://learn.microsoft.com/rest/api/fabric/core/managed-private-endpoints/create-workspace-managed-private-endpoint>.
- Parameters:
name (str) – Name of the managed private endpoint.
target_private_link_resource_id (UUID) – Resource Id of data source for which private endpoint needs to be created.
target_subresource_type (str) – Sub-resource pointing to Private-link resoure.
request_message (str, default=None) – Message to approve private endpoint request. Should not be more than 140 characters.
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_mirrored_database(name: str, description: str | None = None, workspace: str | None = None)
Creates a Fabric mirrored database.
This is a wrapper function for the following API: Items - Create Mirrored Database.
- Parameters:
name (str) – Name of the mirrored database.
description (str, default=None) – A description of the mirrored 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.create_ml_experiment(name: str, description: str | None = None, workspace: str | None = None)
Creates a Fabric ML experiment.
This is a wrapper function for the following API: Items - Create 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.
This is a wrapper function for the following API: Items - Create ML Model.
- Parameters:
name (str) – Name of the ML model.
description (str, default=None) – A description 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.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_notebook(name: str, notebook_content: str, description: str | None = None, workspace: str | None = None)
Creates a new notebook with a definition within a workspace.
- Parameters:
name (str) – The name of the notebook to be created.
notebook_content (str) – The Jupyter notebook content (not in Base64 format).
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.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:
- 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.
This is a wrapper function for the following API: ResourceGroupsOperations Class - CreateOrUpdate.
- 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.
This is a wrapper function for the following API: Items - Create Semantic Model.
- sempy_labs.create_warehouse(warehouse: str, description: str | None = None, case_insensitive_collation: bool = False, workspace: str | None = None)
Creates a Fabric warehouse.
This is a wrapper function for the following API: Items - Create 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.
This is a wrapper function for the following API: Custom Pools - Delete Workspace Custom Pool.
- sempy_labs.delete_data_pipeline(name: str, workspace: str | None = None)
Deletes a Fabric data pipeline.
This is a wrapper function for the following API: Items - Delete Data Pipeline.
- 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.
This is a wrapper function for the following API: Items - Delete Environment.
- sempy_labs.delete_eventhouse(name: str, workspace: str | None = None)
Deletes a Fabric eventhouse.
This is a wrapper function for the following API: Items - Delete Eventhouse.
- sempy_labs.delete_eventstream(name: str, workspace: str | None = None)
Deletes a Fabric eventstream.
This is a wrapper function for the following API: Items - Delete Eventstream.
- 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.
This is a wrapper function for the following API: Fabric Capacities - Delete.
- 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.
This is a wrapper function for the following API: Items - Delete KQL Database.
- sempy_labs.delete_kql_queryset(name: str, workspace: str | None = None)
Deletes a KQL queryset.
This is a wrapper function for the following API: Items - Delete KQL Queryset.
- sempy_labs.delete_managed_private_endpoint(managed_private_endpoint: str, workspace: str | None = None)
Deletes a Fabric managed private endpoint.
This is a wrapper function for the following API: Managed Private Endpoints - Delete Workspace Managed Private Endpoint <https://learn.microsoft.com/rest/api/fabric/core/managed-private-endpoints/delete-workspace-managed-private-endpoint>.
- sempy_labs.delete_mirrored_database(mirrored_database: str, workspace: str | None = None)
Deletes a mirrored database.
This is a wrapper function for the following API: Items - Delete Mirrored Database.
- sempy_labs.delete_ml_experiment(name: str, workspace: str | None = None)
Deletes a Fabric ML experiment.
This is a wrapper function for the following API: Items - Delete ML Experiment.
- sempy_labs.delete_ml_model(name: str, workspace: str | None = None)
Deletes a Fabric ML model.
This is a wrapper function for the following API: Items - Delete ML Model.
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.
This is a wrapper function for the following API: Groups - Delete User In Group.
- sempy_labs.delete_warehouse(name: str, workspace: str | None = None)
Deletes a Fabric warehouse.
This is a wrapper function for the following API: Items - Delete Warehouse.
- 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.
This is a wrapper function for the following API: Workspaces - Derovision Identity.
- 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.
This is a wrapper function for the following API: Datasets - Update Dataset In Group.
- Parameters:
- Returns:
A pandas dataframe showing the current query scale out settings.
- Return type:
- sempy_labs.disconnect_workspace_from_git(workspace: str | None = None)
Disconnects a workpsace from a git repository.
This is a wrapper function for the following API: Git - Disconnect.
- 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:
- 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.
- 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.
- 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.
- 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:
- sempy_labs.get_dax_query_dependencies(dataset: str, dax_string: str, put_in_memory: bool = False, workspace: str | None = None) DataFrame
Obtains the columns on which a DAX query depends, including model dependencies. Shows Vertipaq statistics (i.e. Total Size, Data Size, Dictionary Size, Hierarchy Size) for easy prioritizing.
- Parameters:
dataset (str) – Name of the semantic model.
dax_string (str) – The DAX query.
put_in_memory (bool, default=False) – If True, ensures that the dependent columns are put into memory in order to give realistic Vertipaq stats (i.e. Total Size etc.).
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 dependent columns of a given DAX query including model dependencies.
- Return type:
- sempy_labs.get_dax_query_memory_size(dataset: str, dax_string: str, workspace: str | None = None) int
Obtains the total size, in bytes, used by all columns that a DAX query depends on.
- Parameters:
- Returns:
The total size, in bytes, used by all columns that the DAX query depends on.
- Return type:
- sempy_labs.get_direct_lake_sql_endpoint(dataset: str, workspace: str | None = None) UUID
Obtains the SQL Endpoint ID of the semantic model.
- Parameters:
- Returns:
The ID of SQL Endpoint.
- Return type:
- 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.
This is a wrapper function for the following API: Git - Get Connection.
- 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:
- 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.
This is a wrapper function for the following API: `Git - Get Status <https://learn.microsoft.com/rest/api/fabric/core/git/get-status>.
- 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:
- sempy_labs.get_measure_dependencies(dataset: str, workspace: str | None = None) DataFrame
Shows all dependencies for all measures in a semantic model.
- Parameters:
- Returns:
Shows all dependencies for all measures in the semantic model.
- Return type:
- sempy_labs.get_mirrored_database_definition(mirrored_database: str, workspace: str | None = None, decode: bool = True) str
Obtains the mirrored database definition.
This is a wrapper function for the following API: Items - Get Mirrored Database Definition.
- Parameters:
mirrored_database (str) – The name of the mirrored database.
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 mirrored database definition file into .json format. If False, obtains the mirrored database definition file in base64 format.
- Returns:
The mirrored database definition.
- Return type:
- sempy_labs.get_mirroring_status(mirrored_database: str, workspace: str | None = None) str
Get the status of the mirrored database.
This is a wrapper function for the following API: Mirroring - Get Mirroring Status.
- Parameters:
- Returns:
The status of a mirrored database.
- Return type:
- sempy_labs.get_model_calc_dependencies(dataset: str, workspace: str | None = None) DataFrame
Shows all dependencies for all objects in a semantic model.
- Parameters:
- Returns:
Shows all dependencies for all objects in the semantic model.
- Return type:
- sempy_labs.get_notebook_definition(notebook_name: str, workspace: str | None = None, decode: bool = True) str
Obtains the notebook definition.
This is a wrapper function for the following API: Items - Get 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:
- sempy_labs.get_object_level_security(dataset: str, workspace: str | None = None) DataFrame
Shows the object level security for the semantic model.
- Parameters:
- Returns:
A pandas dataframe showing the object level security for the semantic model.
- Return type:
- 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.
This is a wrapper function for the following API: Items - Get Semantic Model Definition.
- 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:
- sempy_labs.get_semantic_model_refresh_history(dataset: str, request_id: str | None = None, workspace: str | None = None) DataFrame
Obtains the semantic model refresh history (refreshes executed via the Enhanced Refresh API).
This is a wrapper function for the following API: Datasets - Get Refresh History In Group.
- Parameters:
dataset (str) – Name of the semantic model.
request_id (str, default=None) – The request id of a semantic model refresh. Defaults to None which resolves to showing all refresh requests for the given 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 semantic model refresh history.
- Return type:
- sempy_labs.get_spark_settings(workspace: str | None = None, return_dataframe: bool = True) DataFrame | dict
Shows the spark settings for a workspace.
This is a wrapper function for the following API: Workspace Settings - Get Spark Settings.
- 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:
- sempy_labs.get_tables_mirroring_status(mirrored_database: str, workspace: str | None = None) DataFrame
Gets the mirroring status of the tables.
This is a wrapper function for the following API: Mirroring - Get Tables Mirroring Status.
- Parameters:
- Returns:
A pandas dataframe showing the mirroring status of the tables.
- Return type:
- sempy_labs.get_warehouse_columns(warehouse: str, workspace: str | None = None) DataFrame
Shows a list of the columns in each table within the Fabric warehouse. This function is based on INFORMATION_SCHEMA.COLUMNS.
- Parameters:
- Returns:
A pandas dataframe showing a list of the columns in each table within the Fabric warehouse.
- Return type:
- sempy_labs.get_warehouse_tables(warehouse: str, workspace: str | None = None) DataFrame
Shows a list of the tables in the Fabric warehouse. This function is based on INFORMATION_SCHEMA.TABLES.
- Parameters:
- Returns:
A pandas dataframe showing a list of the tables in the Fabric warehouse.
- Return type:
- sempy_labs.import_notebook_from_web(notebook_name: str, url: str, description: str | None = None, workspace: str | None = None, overwrite: bool = False)
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.
overwrite (bool, default=False) – If set to True, overwrites the existing notebook in the workspace if it exists.
- 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:
- Returns:
A visualization of the Vertipaq Analyzer statistics.
- Return type:
- sempy_labs.initialize_git_connection(workspace: str | None = None)
Initializes a connection for a workspace that is connected to Git.
This is a wrapper function for the following API: Git - Initialize Connection.
- 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:
- Returns:
A True/False value indicating whether the semantic model is a default semantic model.
- Return type:
- 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:
- sempy_labs.list_capacities() DataFrame
Shows the capacities and their properties.
- Returns:
A pandas dataframe showing the capacities and their properties
- Return type:
- sempy_labs.list_connections() DataFrame
Lists all available connections.
- Returns:
A pandas dataframe showing all available connections.
- Return type:
- sempy_labs.list_custom_pools(workspace: str | None = None) DataFrame
Lists all custom pools within a workspace.
This is a wrapper function for the following API: Custom Pools - List Workspace Custom Pools.
- 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:
- 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:
- sempy_labs.list_data_pipelines(workspace: str | None = None) DataFrame
Shows the data pipelines within a workspace.
This is a wrapper function for the following API: Items - List Data Pipelines.
- 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:
- sempy_labs.list_dataflow_storage_accounts() DataFrame
Shows the accessible dataflow storage accounts.
This is a wrapper function for the following API: Dataflow Storage Accounts - Get Dataflow Storage Accounts.
- Returns:
A pandas dataframe showing the accessible dataflow storage accounts.
- Return type:
- 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:
- 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:
- 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.
This is a wrapper function for the following API: Deployment Pipelines - List Deployment Pipeline Stage Items.
- Parameters:
- Returns:
A pandas dataframe showing the supported items from the workspace assigned to the specified stage of the specified deployment pipeline.
- Return type:
- sempy_labs.list_deployment_pipeline_stages(deployment_pipeline: str) DataFrame
Shows the specified deployment pipeline stages.
This is a wrapper function for the following API: Deployment Pipelines - List Deployment Pipeline Stages.
- Parameters:
deployment_pipeline (str) – The deployment pipeline name.
- Returns:
A pandas dataframe showing the specified deployment pipeline stages.
- Return type:
- sempy_labs.list_deployment_pipelines() DataFrame
Shows a list of deployment pipelines the user can access.
This is a wrapper function for the following API: Deployment Pipelines - List Deployment Pipelines.
- Returns:
A pandas dataframe showing a list of deployment pipelines the user can access.
- Return type:
- sempy_labs.list_eventhouses(workspace: str | None = None) DataFrame
Shows the eventhouses within a workspace.
This is a wrapper function for the following API: Items - List Eventhouses.
- 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:
- sempy_labs.list_eventstreams(workspace: str | None = None) DataFrame
Shows the eventstreams within a workspace.
This is a wrapper function for the following API: Items - List Eventstreams.
- 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:
Returns a list of the external data shares that exist for the specified item.
This is a wrapper function for the following API: `External Data Shares - List External Data Shares In Item <https://learn.microsoft.com/rest/api/fabric/core/external-data-shares/list-external-data-shares-in-item`_.
- Parameters:
- Returns:
A pandas dataframe showing a list of the external data shares that exist for the specified item.
- Return type:
- 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:
- Returns:
A pandas dataframe showing the list of connections that the specified item is connected to.
- Return type:
- sempy_labs.list_kql_databases(workspace: str | None = None) DataFrame
Shows the KQL databases within a workspace.
This is a wrapper function for the following API: Items - List KQL Databases.
- 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:
- sempy_labs.list_kql_querysets(workspace: str | None = None) DataFrame
Shows the KQL querysets within a workspace.
This is a wrapper function for the following API: Items - List KQL Querysets.
- 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:
- 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:
- sempy_labs.list_managed_private_endpoints(workspace: str | None = None) DataFrame
Shows the managed private endpoints within a workspace.
This is a wrapper function for the following API: Managed Private Endpoints - List Workspace Managed Private Endpoints <https://learn.microsoft.com/rest/api/fabric/core/managed-private-endpoints/list-workspace-managed-private-endpoints>.
- 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 managed private endpoints within a workspace.
- Return type:
- sempy_labs.list_mirrored_databases(workspace: str | None = None) DataFrame
Shows the mirrored databases within a workspace.
This is a wrapper function for the following API: Items - List Mirrored Databases.
- 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 databases within a workspace.
- Return type:
- sempy_labs.list_mirrored_warehouses(workspace: str | None = None) DataFrame
Shows the mirrored warehouses within a workspace.
This is a wrapper function for the following API: Items - List Mirrored Warehouses.
- 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:
- sempy_labs.list_ml_experiments(workspace: str | None = None) DataFrame
Shows the ML experiments within a workspace.
This is a wrapper function for the following API: Items - List ML Experiments.
- 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:
- sempy_labs.list_ml_models(workspace: str | None = None) DataFrame
Shows the ML models within a workspace.
This is a wrapper function for the following API: Items - List ML Models.
- 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:
- 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:
- Returns:
A pandas dataframe showing the query scale out settings.
- Return type:
- 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:
- Returns:
A pandas dataframe showing the reports which use a given semantic model.
- Return type:
- 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:
- sempy_labs.list_semantic_model_objects(dataset: str, workspace: str | None = None) DataFrame
Shows a list of semantic model objects.
- Parameters:
- Returns:
A pandas dataframe showing a list of objects in the semantic model
- Return type:
- 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:
- 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:
- 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:
- Returns:
A pandas dataframe showing a list of files contained within an ADLS Gen2 storage account.
- Return type:
- sempy_labs.list_upstream_dataflows(dataflow: str | UUID, workspace: str | None = None) DataFrame
Shows a list of upstream dataflows for the specified dataflow.
This is a wrapper function for the following API: Dataflows - Get Upstream Dataflows In Group.
- Parameters:
- Returns:
A pandas dataframe showing a list of upstream dataflows for the specified dataflow.
- Return type:
- sempy_labs.list_warehouses(workspace: str | None = None) DataFrame
Shows the warehouses within a workspace.
This is a wrapper function for the following API: Items - List Warehouses.
- 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:
- sempy_labs.list_workloads(capacity_name: str) DataFrame
Returns the current state of the specified capacity workloads. If a workload is enabled, the percentage of maximum memory that the workload can consume is also returned.
This is a wrapper function for the following API: Capacities - Get Workloads.
- Parameters:
capacity_name (str) – The capacity name.
- Returns:
A pandas dataframe showing the current state of the specified capacity workloads.
- Return type:
- sempy_labs.list_workspace_role_assignments(workspace: str | None = None) DataFrame
Shows the members of a given workspace.
This is a wrapper function for the following API: Workspaces - List Workspace Role Assignments.
- 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:
- sempy_labs.list_workspace_users(workspace: str | None = None) DataFrame
A list of all the users of a workspace and their roles.
This is a wrapper function for the following API: Workspaces - List Workspace Role Assignments.
- 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:
- 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:
- 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.
- 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.
- 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.
- sempy_labs.migrate_disaster_recovery_settings(source_capacity: str, target_capacity: str)
This function migrates a capacity’s disaster recovery settings to another 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_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_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.
- 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.
- 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:
- sempy_labs.patch_workload(capacity_name: str, workload_name: str, state: str | None = None, max_memory_percentage: int | None = None)
Changes the state of a specific workload to Enabled or Disabled. When enabling a workload, specify the percentage of maximum memory that the workload can consume.
This is a wrapper function for the following API: Capacities - Patch Workload.
- sempy_labs.provision_workspace_identity(workspace: str | None = None)
Provisions a workspace identity for a workspace.
This is a wrapper function for the following API: Workspaces - Provision Identity.
- 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.
- 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.
This is a wrapper function for the following API: Datasets - Trigger Query Scale Out Sync In Group.
- 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.
This is a wrapper function for the following API: Datasets - Get Query Scale Out Sync Status In Group.
- Parameters:
- 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, visualize: bool = False) DataFrame | 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.
visualize (bool, default=False) – If True, displays a Gantt chart showing the refresh statistics for each table/partition.
- Returns:
If ‘visualize’ is set to True, returns a pandas dataframe showing the SSAS trace output used to generate the visualization.
- Return type:
pandas.DataFrame | None
- 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:
- 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:
- Returns:
The semantic model UUID, semantic model name, semantic model workspace UUID, semantic model workspace name
- Return type:
- sempy_labs.resolve_dataset_id(dataset: str, workspace: str | None = None) UUID
Obtains the ID of the semantic model.
- Parameters:
- 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:
- 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:
- sempy_labs.resolve_lakehouse_id(lakehouse: str, workspace: str | None = None) UUID
Obtains the ID of the Fabric lakehouse.
- Parameters:
- 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:
- sempy_labs.resolve_report_id(report: str, workspace: str | None = None) UUID
Obtains the ID of the Power BI report.
- Parameters:
- 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:
- 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.
- 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.
This is a wrapper function for the following API: Fabric Capacities - Resume.
- 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.
Revokes the specified external data share. Note: This action cannot be undone.
This is a wrapper function for the following API: `External Data Shares - Revoke External Data Share <https://learn.microsoft.com/rest/api/fabric/core/external-data-shares/revoke-external-data-share`_.
- 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 name or 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:
- 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'], skip_models_in_workspace: dict | None = None)
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:
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.
skip_models_in_workspace (dict, default=None) –
A dictionary showing specific semantic models within specific workspaces to skip. See the example below: {
”Workspace A”: [“Dataset1”, “Dataset2”], “Workspace B”: [“Dataset5”, “Dataset 8”],
}
- 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.
This is a wrapper function for the following API: Datasets - Update Dataset In Group.
- 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:
- 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.start_mirroring(mirrored_database: str, workspace: str | None = None)
Starts the mirroring for a database.
This is a wrapper function for the following API: Mirroring - Start Mirroring.
- sempy_labs.stop_mirroring(mirrored_database: str, workspace: str | None = None)
Stops the mirroring for a database.
This is a wrapper function for the following API: Mirroring - Stop Mirroring.
- 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.
This is a wrapper function for the following API: Fabric Capacities - Suspend.
- 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:
- sempy_labs.unassign_workspace_from_capacity(workspace: str | None = None)
Unassigns a workspace from its assigned capacity.
This is a wrapper function for the following API: Workspaces - Unassign From 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.
This is a wrapper function for the following API: Custom Pools - Update Workspace Custom Pool.
- 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.
This is a wrapper function for the following API: Fabric Capacities - Update.
- 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.
This is a wrapper function for the following API: Git - Update From Git.
- 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_mirrored_database_definition(mirrored_database: str, mirrored_database_content: dict, workspace: str | None = None)
Updates an existing notebook with a new definition.
- Parameters:
mirrored_database (str) – The name of the mirrored database to be created.
mirrored_database_content (dict) – The mirrored database definition (not in Base64 format).
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.update_notebook_definition(name: str, notebook_content: str, workspace: str | None = None)
Updates an existing notebook with a new definition.
- Parameters:
name (str) – The name of the notebook to be updated.
notebook_content (str) – The Jupyter notebook content (not in Base64 format).
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.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.
This is a wrapper function for the following API: Items - Update Semantic Model Definition.
- 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.
This is a wrapper function for the following API: Workspace Settings - Update Spark Settings.
- 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.
This is a wrapper function for the following API: Groups - Update Group User.
- 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).