sempy_labs package

Subpackages

Module contents

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

Adds a user to a workspace.

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

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

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

sempy_labs.assign_workspace_to_capacity(capacity_name: str, workspace: str | None = None)

Assigns a workspace to a capacity.

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

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

sempy_labs.assign_workspace_to_dataflow_storage(dataflow_storage_account: str, workspace: str | None = None)

Assigns a dataflow storage account to a workspace.

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

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

sempy_labs.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.clear_cache(dataset: str, workspace: str | None = None)

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

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

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

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

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

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

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

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

Returns:

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

Return type:

str

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

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.

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 | None = 'MemoryOptimized', auto_scale_enabled: bool | None = True, dynamic_executor_allocation_enabled: bool | None = True, workspace: str | None = None)

Creates a custom pool within a workspace.

Parameters:
sempy_labs.create_relationship_name(from_table: str, from_column: str, to_table: str, to_column: str)

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

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

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

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

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

Returns:

The fully qualified relationship name.

Return type:

str

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

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

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

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

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

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

Creates a Fabric warehouse.

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

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

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

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

Deletes a custom pool within a workspace.

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

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

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

Removes a user from a workspace.

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

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

sempy_labs.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 | None = True)

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.

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

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

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

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

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

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

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

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

  • dax_query (str) – The DAX query.

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

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

Returns:

A pandas dataframe holding the result of the DAX query.

Return type:

pandas.DataFrame

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

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

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

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

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

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

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

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

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

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

Returns:

The fully qualified object name.

Return type:

str

sempy_labs.generate_embedded_filter(filter: str)

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

Parameters:

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

Returns:

A filter expression usable by a Power BI embedded URL.

Return type:

str

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

Obtains the SQL Endpoint ID of the semantic model.

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

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

Returns:

The ID of SQL Endpoint.

Return type:

uuid.UUID

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

Shows all dependencies for all measures in a semantic model.

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

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

Returns:

Shows all dependencies for all measures in the semantic model.

Return type:

pandas.DataFrame

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

Shows all dependencies for all objects in a semantic model.

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

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

Returns:

Shows all dependencies for all objects in the semantic model.

Return type:

pandas.DataFrame

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

Shows the object level security for the semantic model.

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

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

Returns:

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

Return type:

pandas.DataFrame

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

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

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

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

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

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

Returns:

The Model.bim file for the semantic model.

Return type:

str

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

Shows the spark settings for a workspace.

Parameters:

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

Returns:

A pandas dataframe showing the spark settings for a workspace.

Return type:

pandas.DataFrame

sempy_labs.import_vertipaq_analyzer(folder_path: str, file_name: str)

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

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

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

Returns:

A visualization of the Vertipaq Analyzer statistics.

Return type:

str

sempy_labs.list_capacities() DataFrame

Shows the capacities and their properties.

Returns:

A pandas dataframe showing the capacities and their properties

Return type:

pandas.DataFrame

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

Lists all custom pools within a workspace.

Parameters:

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

Returns:

A pandas dataframe showing all the custom pools within the Fabric workspace.

Return type:

pandas.DataFrame

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

Shows a list of the dashboards within a workspace.

Parameters:

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

Returns:

A pandas dataframe showing the dashboards within a workspace.

Return type:

pandas.DataFrame

sempy_labs.list_dataflow_storage_accounts() DataFrame

Shows the accessible dataflow storage accounts.

Returns:

A pandas dataframe showing the accessible dataflow storage accounts.

Return type:

pandas.DataFrame

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

Shows the lakehouses within a workspace.

Parameters:

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

Returns:

A pandas dataframe showing the lakehouses within a workspace.

Return type:

pandas.DataFrame

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

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

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

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

Returns:

A pandas dataframe showing the query scale out settings.

Return type:

pandas.DataFrame

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

Shows a list of semantic model objects.

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

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

Returns:

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

Return type:

pandas.DataFrame

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

Shows all shortcuts which exist in a Fabric lakehouse.

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

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

Returns:

A pandas dataframe showing all the shortcuts which exist in the specified lakehouse.

Return type:

pandas.DataFrame

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

Shows the warehouses within a workspace.

Parameters:

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

Returns:

A pandas dataframe showing the warehouses within a workspace.

Return type:

pandas.DataFrame

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

Shows the members of a given workspace.

Parameters:

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

Returns:

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

Return type:

pandas.DataFrame

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

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

Parameters:

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

Returns:

A pandas dataframe the users of a workspace and their properties.

Return type:

pandas.DataFrame

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

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

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

  • measure_name (str) – Name of the measure.

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

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

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

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.

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

Returns:

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

Return type:

pandas.DataFrame

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

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

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

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

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

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

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

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

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

Refreshes a semantic model.

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

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

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

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

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

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

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

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

Obtains the ID of the semantic model.

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

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

Returns:

The ID of the semantic model.

Return type:

UUID

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

Obtains the name of the semantic model.

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

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

Returns:

The name of the semantic model.

Return type:

str

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

Obtains the ID of the Fabric lakehouse.

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

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

Returns:

The ID of the Fabric lakehouse.

Return type:

UUID

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

Obtains the name of the Fabric lakehouse.

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

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

Returns:

The name of the Fabric lakehouse.

Return type:

str

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

Obtains the ID of the Power BI report.

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

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

Returns:

The ID of the Power BI report.

Return type:

UUID

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

Obtains the name of the Power BI report.

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

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

Returns:

The name of the Power BI report.

Return type:

str

sempy_labs.run_model_bpa(dataset: str, rules: DataFrame | None = None, workspace: str | None = None, export: bool | None = False, return_dataframe: bool | None = False, extended: bool | None = False, **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.

Returns:

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

Return type:

pandas.DataFrame

sempy_labs.save_as_delta_table(dataframe, delta_table_name: str, write_mode: str, 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’.

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

Returns:

The ID of the Power BI report.

Return type:

UUID

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

Sets the query scale out settings for a semantic model.

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

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

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

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

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.translate_semantic_model(dataset: str, languages: str | List[str], exclude_characters: str | None = None, workspace: str | None = None)

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.

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

Unassigns a workspace from its assigned capacity.

Parameters:

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

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

Updates the properties of a custom pool within a workspace.

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

  • node_size (str, default=None) –

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

  • min_node_count (int, default=None) –

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

  • max_node_count (int, default=None) –

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

  • min_executors (int, default=None) –

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

  • max_executors (int, default=None) –

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

  • node_family (str, default=None) –

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

  • auto_scale_enabled (bool, default=None) –

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

  • dynamic_executor_allocation_enabled (bool, default=None) –

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

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

sempy_labs.update_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_spark_settings(automatic_log_enabled: bool | None = None, high_concurrency_enabled: bool | None = None, customize_compute_enabled: bool | None = None, default_pool_name: str | None = None, max_node_count: int | None = None, max_executors: int | None = None, environment_name: str | None = None, runtime_version: str | None = None, workspace: str | None = None)

Updates the spark settings for a workspace.

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

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

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

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

  • max_node_count (int, default=None) –

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

  • max_executors (int, default=None) –

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

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

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

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

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

Updates a user’s role within a workspace.

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

  • role_name (str) –

    The role of the user within the workspace.

  • 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, lakehouse_workspace: str | None = None, read_stats_from_data: bool | None = False)

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.

  • lakehouse_workspace (str, default=None) – The Fabric workspace used by the lakehouse (for Direct Lake semantic models). Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

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