fabric Package

Packages

exceptions
matcher

Classes

DataCategory

PowerBI data categories for metadata stored in FabricDataFrame.

FabricDataFrame

A dataframe for storage and propogation of PowerBI metadata.

The elements of column_metadata can contain the following keys:

  • table: table name in originating dataset

  • column: column name

  • dataset: originating dataset name

  • workspace_id: string form of workspace GUID

  • workspace_name: friendly name of originating workspace

  • description: description of column (if one is present)

  • data_type: PowerBI data type for this column

  • data_category: PowerBI data category for this column

  • alignment: PowerBI visual alignment for this column

FabricRestClient

REST client to access Fabric REST endpoints. Authentication tokens are automatically acquired from the execution environment.

Experimental: This class is experimental and may change in future versions.

FabricSeries

A series for storage and propogation of PowerBI metadata.

MetadataKeys

Keys for column metadata in FabricDataFrame.

Column properties can be found here.

PowerBIRestClient

REST client to access PowerBI REST endpoints. Authentication tokens are automatically acquired from the execution environment.

Experimental: This class is experimental and may change in future versions.

RefreshExecutionDetails

The status of a refresh request (Power BI Documentation).

Trace

Trace object for collecting diagnostic and performance related information from the Microsoft Analysis Services Tabular server.

Python wrapper around Microsoft Analysis Services Trace

NOTE: This feature is only intended for exploratory use. Due to the asynchronous communication required between the Microsoft Analysis Services (AS) Server and other AS clients, trace events are registered on a best-effort basis where timings are dependent on server load.

TraceConnection

Connection object for starting, viewing, and removing Traces.

Python wrapper around Microsoft Analysis Services Tabular Server.

Functions

create_lakehouse

Create a lakehouse in the specified workspace.

create_lakehouse(display_name: str, description: str | None = None, max_attempts: int = 10, workspace: str | UUID | None = None) -> str

Parameters

Name Description
display_name
Required
str

The display name of the lakehouse.

description
str

The optional description of the lakehouse.

default value: None
max_attempts
int

Maximum number of retries to wait for creation of the notebook.

default value: 10
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description
str

The id of lakehouse.

create_notebook

Create a notebook in the specified workspace.

create_notebook(display_name: str, description: str | None = None, content: str | dict | None = None, default_lakehouse: str | UUID | None = None, default_lakehouse_workspace: str | UUID | None = None, max_attempts: int = 10, workspace: str | UUID | None = None) -> str

Parameters

Name Description
display_name
Required
str

The display name of the lakehouse.

description
str

The optional description of the lakehouse.

default value: None
content
str or dict

The optional notebook content (JSON).

default value: None
default_lakehouse
str or UUID

The optional lakehouse name or UUID object to attach to the new notebook.

default value: None
default_lakehouse_workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID the lakehouse is in. If None, the workspace specified for the notebook is used.

default value: None
max_attempts
int

Maximum number of retries to wait for creation of the notebook.

default value: 10
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description
str

The notebook id.

create_tom_server

Create a TOM server for the specified workspace.

Note that not all properties and methods of the Tabular Object Model (TOM) are supported due to limitation when bridging Python to .NET.

If changes are made to models, make sure to call SaveChanges() on the model object and invoke refresh_tom_cache().

create_tom_server(readonly: bool = True, workspace: str | UUID | None = None) -> Microsoft.AnalysisServices.Tabular.Server

Parameters

Name Description
readonly

Whether to create a read-only server.

default value: True
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description
<xref:Microsoft.AnalysisServices.Tabular.Server>

The TOM server.

create_trace_connection

Create a TraceConnection to the server specified by the dataset.

NOTE: This feature is only intended for exploratory use. Due to the asynchronous communication required between the Microsoft Analysis Services (AS) Server and other AS clients, trace events are registered on a best-effort basis where timings are dependent on server load.

create_trace_connection(dataset: str | UUID, workspace: str | UUID | None = None) -> TraceConnection

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset to list traces on.

workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description

Server connected to specified dataset.

create_workspace

Create a workspace.

create_workspace(display_name: str, capacity_id: str | None = None, description: str | None = None) -> str

Parameters

Name Description
display_name
Required
str

The display name of the workspace.

capacity_id
str

The optional capacity id.

default value: None
description
str

The optional description of the workspace.

default value: None

Returns

Type Description
str

The id of workspace.

delete_item

Delete the item in the specified workspace.

delete_item(item_id: str, workspace: str | UUID | None = None)

Parameters

Name Description
item_id
Required
str

The id of the item.

workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

evaluate_dax

Compute DAX query for a given dataset.

evaluate_dax(dataset: str | UUID, dax_string: str, workspace: str | UUID | None = None, verbose: int = 0) -> FabricDataFrame

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

dax_string
Required
str

The DAX query.

workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None
verbose
int

Verbosity. 0 means no verbosity.

default value: 0

Returns

Type Description

FabricDataFrame holding the result of the DAX query.

evaluate_measure

Compute PowerBI measure for a given dataset.

evaluate_measure(dataset: str | UUID, measure: str | List[str], groupby_columns: List[str] | None = None, filters: Dict[str, List[str]] | None = None, fully_qualified_columns: bool | None = None, num_rows: int | None = None, use_xmla: bool = False, workspace: str | UUID | None = None, verbose: int = 0) -> FabricDataFrame

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

measure
Required
str or list of str

Name of the measure, or list of measures to compute.

groupby_columns

List of columns in a fully qualified form e.g. "TableName[ColumnName]" or "'Table Name'[Column Name]".

default value: None
filters

Dictionary containing a list of column values to filter the output by, where the key is a column reference, which must be fully qualified with the table name. Currently only supports the "in" filter. For example, to specify that in the "State" table the "Region" column can only be "East" or "Central" and that the "State" column can only be "WA" or "CA":


   {
       "State[Region]":    ["East", "Central"],
       "State[State]":     ["WA", "CA"]
   }
default value: None
fully_qualified_columns

Whether to output columns in their fully qualified form (TableName[ColumnName] for dimensions). Measures are always represented without the table name. If None, the fully qualified form will only be used if there is a name conflict between columns from different tables.

default value: None
num_rows
int

How many rows of the table to return. If None, all rows are returned.

default value: None
use_xmla

Whether or not to use XMLA as the backend for evaluation. When False, REST backend will be used.

default value: False
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None
verbose
int

Verbosity. 0 means no verbosity.

default value: 0

Returns

Type Description

FabricDataFrame holding the computed measure stratified by groupby columns.

execute_tmsl

Execute TMSL script.

execute_tmsl(script: Dict | str, refresh_tom_cache: bool = True, workspace: str | UUID | None = None)

Parameters

Name Description
script
Required
Dict or str

The TMSL script json.

refresh_tom_cache

Whether or not to refresh the dataset after executing the TMSL script.

default value: True
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

execute_xmla

Execute XMLA command for a given dataset.

e.g. clear cache when optimizing DAX queries.

execute_xmla(dataset: str | UUID, xmla_command: str, workspace: str | UUID | None = None) -> int

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

xmla_command
Required
str

The XMLA command.

workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description
int

Number of rows affected.

get_artifact_id

Return artifact id.

get_artifact_id() -> str

Returns

Type Description
str

Artifact (most commonly notebook) id guid.

get_lakehouse_id

Return lakehouse id of the lakehouse that is connected to the workspace.

get_lakehouse_id() -> str

Returns

Type Description
str

Lakehouse id guid.

get_notebook_workspace_id

Return notebook workspace id.

get_notebook_workspace_id() -> str

Returns

Type Description
str

Workspace id guid.

get_refresh_execution_details

Poll the status for a specific refresh requests using Enhanced refresh with the Power BI REST API.

More details on the underlying implementation in PBI Documentation

get_refresh_execution_details(dataset: str | UUID, refresh_request_id: str | UUID, workspace: str | UUID | None = None) -> RefreshExecutionDetails

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

refresh_request_id
Required
str or UUID

Id of refresh request on which to check the status.

workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description

RefreshExecutionDetails instance with statuses of refresh request retrieved based on the passed URL.

get_roles

Retrieve all roles associated with the dataset.

get_roles(dataset: str | UUID, include_members: bool = False, additional_xmla_properties: List[str] | None = None, workspace: str | UUID | None = None) -> DataFrame

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

include_members

Whether or not to include members for each role.

default value: False
additional_xmla_properties

Additional XMLA role properties to include in the returned dataframe.

default value: None
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description

Dataframe listing roles and with their attributes.

get_row_level_security_permissions

Retrieve row level security permissions for a dataset.

get_row_level_security_permissions(dataset: str | UUID, additional_xmla_properties: List[str] | None = None, workspace: str | UUID | None = None) -> DataFrame

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

additional_xmla_properties

Additional XMLA tablepermission properties to include in the returned dataframe.

default value: None
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description

Dataframe listing tables and row filter expressions (DAX) for the dataset.

get_tmsl

Retrieve the Tabular Model Scripting Language (TMSL) for a given dataset.

get_tmsl(dataset: str | UUID, workspace: str | UUID | None = None) -> str

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description
str

TMSL for the given dataset.

get_workspace_id

Return workspace id.

get_workspace_id() -> str

Returns

Type Description
str

Workspace id guid.

list_annotations

List all annotations in a dataset.

list_annotations(dataset: str | UUID, additional_xmla_properties: List[str] | None = None, workspace: str | UUID | None = None) -> DataFrame

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

additional_xmla_properties

Additional XMLA annotation properties to include in the returned dataframe.

default value: None
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description

Dataframe listing all annotations.

list_apps

List all the Power BI apps.

list_apps() -> DataFrame

Returns

Type Description

DataFrame with one row per app.

list_calculation_items

List all calculation items for each group in a dataset.

list_calculation_items(dataset: str | UUID, additional_xmla_properties: List[str] | None = None, workspace: str | UUID | None = None) -> DataFrame

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

additional_xmla_properties

Additional XMLA calculationitem properties to include in the returned dataframe.

default value: None
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description

Dataframe listing all calculation groups.

list_capacities

Return a list of capacities that the principal has access to (details).

list_capacities() -> DataFrame

Returns

Type Description

Dataframe listing the capacities.

list_columns

List all columns for all tables in a dataset.

list_columns(dataset: str | UUID, table: str | None = None, extended: bool | None = False, additional_xmla_properties: List[str] | None = None, workspace: str | UUID | None = None) -> DataFrame

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

table
str

Name of the table.

default value: None
extended

Fetches extended column information.

default value: False
additional_xmla_properties

Additional XMLA column properties to include in the returned dataframe.

default value: None
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description

Dataframe listing the columns.

list_dataflows

List all the Power BI dataflows.

list_dataflows() -> DataFrame

Returns

Type Description

DataFrame with one row per data flow.

list_datasets

List datasets in a Fabric workspace.

list_datasets(workspace: str | UUID | None = None, mode: str = 'xmla', additional_xmla_properties: List[str] | None = None) -> DataFrame

Parameters

Name Description
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None
mode
str

Whether to use the XMLA "xmla" or REST API "rest". See REST docs for returned fields.

default value: "xmla"
additional_xmla_properties

Additional XMLA model properties to include in the returned dataframe.

default value: None

Returns

Type Description

Dataframe listing databases and their attributes.

list_datasources

List all datasources in a dataset.

list_datasources(dataset: str | UUID, additional_xmla_properties: List[str] | None = None, workspace: str | UUID | None = None) -> DataFrame

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

additional_xmla_properties

Additional XMLA datasource properties to include in the returned dataframe.

default value: None
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description

Dataframe listing all datasources.

list_expressions

List all expressions in a dataset.

list_expressions(dataset: str | UUID, additional_xmla_properties: List[str] | None = None, workspace: str | UUID | None = None) -> DataFrame

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

additional_xmla_properties

Additional XMLA expression properties to include in the returned dataframe.

default value: None
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description

Dataframe listing the expressions.

list_gateways

List all the Power BI gateways.

list_gateways() -> DataFrame

Returns

Type Description

DataFrame with one row per gateway.

list_hierarchies

List hierarchies in a dataset.

list_hierarchies(dataset: str | UUID, extended: bool | None = False, additional_xmla_properties: List[str] | None = None, workspace: str | UUID | None = None) -> DataFrame

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

extended

Fetches extended column information.

default value: False
additional_xmla_properties

Additional XMLA level properties to include in the returned dataframe. Use Parent to navigate to the parent level.

default value: None
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description

Dataframe listing the hierachies and their attributes.

list_items

Return a list of items in the specified workspace.

list_items(type: str | None = None, workspace: str | UUID | None = None) -> DataFrame

Parameters

Name Description
type
str

Filter the list of items by the type specified (see valid types).

default value: None
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description

DataFrame with one row per artifact.

list_measures

Retrieve all measures associated with the given dataset.

list_measures(dataset: str | UUID, additional_xmla_properties: List[str] | None = None, workspace: str | UUID | None = None) -> DataFrame

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

additional_xmla_properties

Additional XMLA measure properties to include in the returned dataframe.

default value: None
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description

Dataframe listing measures and their attributes.

list_partitions

List all partitions in a dataset.

list_partitions(dataset: str | UUID, table: str | None = None, extended: bool | None = False, additional_xmla_properties: List[str] | None = None, workspace: str | UUID | None = None) -> DataFrame

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

table
str

Name of the table.

default value: None
extended

Fetches extended column information.

default value: False
additional_xmla_properties

Additional XMLA partition properties to include in the returned dataframe. Use Parent to navigate to the parent level.

default value: None
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description

Dataframe listing the partitions.

list_perspectives

List all perspectives in a dataset.

list_perspectives(dataset: str | UUID, additional_xmla_properties: List[str] | None = None, workspace: str | UUID | None = None) -> DataFrame

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

additional_xmla_properties

Additional XMLA perspective properties to include in the returned dataframe.

default value: None
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description

Dataframe listing all perspectives.

list_refresh_requests

Poll the status or refresh requests for a given dataset using Enhanced refresh with the Power BI REST API.

See details in: PBI Documentation

list_refresh_requests(dataset: str | UUID, workspace: str | UUID | None = None, top_n: int | None = None) -> DataFrame

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None
top_n
int

Limit the number of refresh operations returned.

default value: = None

Returns

Type Description

Dataframe with statuses of refresh request retrieved based on the passed parameters.

list_relationship_violations

Validate if the content of tables matches relationships.

Relationships are extracted from the metadata in FabricDataFrames. The function examines results of joins for provided relationships and searches for inconsistencies with the specified relationship multiplicity.

Relationships from empty tables (dataframes) are assumed as valid.

list_relationship_violations(tables: Dict[str, FabricDataFrame] | List[FabricDataFrame], missing_key_errors='raise', coverage_threshold: float = 1.0, n_keys: int = 10) -> DataFrame

Parameters

Name Description
tables
Required

A dictionary that maps table names to the dataframes with table content. If a list of dataframes is provided, the function will try to infer the names from the session variables and if it cannot, it will use the positional index to describe them in the results.

missing_key_errors
str

One of 'raise', 'warn', 'ignore'. Action to take when either table or column of the relationship is not found in the elements of the argument tables.

default value: 'raise'
coverage_threshold

Fraction of rows in the "from" part that need to join in inner join.

default value: 1.0
n_keys
int

Number of missing keys to report. Random collection can be reported.

default value: 10

Returns

Type Description

Dataframe with relationships, error type and error message. If there are no violations, returns an empty DataFrame.

list_relationships

List all relationship found within the Power BI model.

list_relationships(dataset: str | UUID, extended: bool | None = False, additional_xmla_properties: List[str] | None = None, calculate_missing_rows: bool | None = False, workspace: str | UUID | None = None) -> DataFrame

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

extended

Fetches extended column information.

default value: False
additional_xmla_properties

Additional XMLA relationship properties to include in the returned dataframe. Use Parent to navigate to the parent level.

default value: None
calculate_missing_rows

Calculate the number of missing rows in the relationship.

default value: False
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description

DataFrame with one row per relationship.

list_reports

Return a list of reports in the specified workspace.

list_reports(workspace: str | UUID | None = None) -> DataFrame

Parameters

Name Description
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description

DataFrame with one row per report.

list_tables

List all tables in a dataset.

list_tables(dataset: str | UUID, include_columns: bool = False, include_partitions: bool = False, extended: bool = False, additional_xmla_properties: List[str] | None = None, workspace: str | UUID | None = None) -> DataFrame

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

include_columns

Whether or not to include column level information. Cannot be combined with include_partitions or extended.

default value: False
include_partitions

Whether or not to include partition level information. Cannot be combined with include_columns or extended.

default value: False
extended

Fetches extended table information information. Cannot be combined with include_columns or include_partitions.

default value: False
additional_xmla_properties

Additional XMLA table properties to include in the returned dataframe.

default value: None
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description

Dataframe listing the tables and optional columns.

list_translations

List all translations in a dataset.

list_translations(dataset: str | UUID, additional_xmla_properties: List[str] | None = None, workspace: str | UUID | None = None) -> DataFrame

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

additional_xmla_properties

Additional XMLA tramslation properties to include in the returned dataframe.

default value: None
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description

Dataframe listing the translations.

list_workspaces

Return a list of workspaces the user has access to.

list_workspaces(filter: str | None = None, top: int | None = None, skip: int | None = None) -> DataFrame

Parameters

Name Description
filter
str

OData filter expression. For example, to filter by name, use "name eq 'My workspace'".

default value: None
top
int

Maximum number of workspaces to return.

default value: None
skip
int

Number of workspaces to skip.

default value: None

Returns

Type Description

DataFrame with one row per workspace.

plot_relationships

Visualize relationship dataframe with a graph.

plot_relationships(tables: Dict[str, FabricDataFrame] | List[FabricDataFrame], include_columns='keys', missing_key_errors='raise', *, graph_attributes: Dict | None = None) -> Digraph

Parameters

Name Description
tables
Required

A dictionary that maps table names to the dataframes with table content. If a list of dataframes is provided, the function will try to infer the names from the session variables and if it cannot, it will use the positional index to describe them in the results. It needs to provided only when include_columns = 'all' and it will be used for mapping table names from relationships to the dataframe columns.

include_columns
str

One of 'keys', 'all', 'none'. Indicates which columns should be included in the graph.

default value: 'keys'
missing_key_errors
str

One of 'raise', 'warn', 'ignore'. Action to take when either table or column of the relationship is not found in the elements of the argument tables.

default value: 'raise'
graph_attributes

Attributes passed to graphviz. Note that all values need to be strings. Useful attributes are:

  • rankdir: "TB" (top-bottom) or "LR" (left-right)

  • dpi: "100", "30", etc. (dots per inch)

  • splines: "ortho", "compound", "line", "curved", "spline" (line shape)

default value: None

Returns

Type Description

Graph object containing all relationships. If include_attributes is true, attributes are represented as ports in the graph.

read_parquet

Read FabricDataFrame from a parquet file specified by path parameter using Arrow including column metadata.

read_parquet(path: str) -> FabricDataFrame

Parameters

Name Description
path
Required
str

String containing the filepath to where the parquet is located.

Returns

Type Description

FabricDataFrame containing table data from specified parquet.

read_table

Read a PowerBI table into a FabricDataFrame.

read_table(dataset: str | UUID, table: str, fully_qualified_columns: bool = False, num_rows: int | None = None, multiindex_hierarchies: bool = False, mode: str = 'xmla', workspace: str | UUID | None = None, verbose: int = 0) -> FabricDataFrame

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

table
Required
str

Name of the table to read.

fully_qualified_columns

Whether or not to represent columns in their fully qualified form (TableName[ColumnName]).

default value: False
num_rows
int

How many rows of the table to return. If None, all rows are returned.

default value: None
multiindex_hierarchies

Whether or not to convert existing PowerBI Hierarchies to pandas MultiIndex.

default value: False
mode
str

Whether to use the XMLA "xmla", REST API "rest", export of import datasets to Onelake "onelake" to retrieve the data.

default value: "xmla"
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None
verbose
int

Verbosity. 0 means no verbosity.

default value: 0

Returns

Type Description

Dataframe for the given table name with metadata from the PowerBI model.

refresh_dataset

Refresh data associated with the given dataset.

For detailed documentation on the implementation see Enhanced refresh with the Power BI REST API.

refresh_dataset(dataset: str | UUID, workspace: str | UUID | None = None, refresh_type: str = 'automatic', max_parallelism: int = 10, commit_mode: str = 'transactional', retry_count: int = 0, objects: List | None = None, apply_refresh_policy: bool = True, effective_date: date = datetime.date(2024, 4, 18), verbose: int = 0) -> str

Parameters

Name Description
dataset
Required
str or UUID

Name or UUID of the dataset.

workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None
refresh_type
str

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 "automatic".

default value: "automatic"
max_parallelism
int

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.

default value: 10
commit_mode
str

Determines whether to commit objects in batches or only when complete. Modes are "transactional" and "partialBatch". Defaults to "transactional".

default value: "transactional"
retry_count
int

Number of times the operation retries before failing. Defaults to 0.

default value: 0
objects

A list of objects to process. Each object includes table when processing an entire table, or table and partition when processing a partition. If no objects are specified, the entire dataset refreshes. Pass output of json.dumps of a structure that specifies the objects that you want to refresh. For example, this is to refresh "DimCustomer1" partition of table "DimCustomer" and complete table "DimDate":


   [
       {
           "table": "DimCustomer",
           "partition": "DimCustomer1"
       },
       {
           "table": "DimDate"
       }
   ]
default value: None
apply_refresh_policy

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.

default value: True
effective_date

If an incremental refresh policy is applied, the effectiveDate parameter overrides the current date.

default value: datetime.date.today()
verbose
int

If set to non-zero, extensive log output is printed.

default value: 0

Returns

Type Description
str

The refresh request id.

refresh_tom_cache

Refresh TOM cache in the notebook kernel.

refresh_tom_cache(workspace: str | UUID | None = None)

Parameters

Name Description
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

resolve_workspace_id

Resolve the workspace name or ID to the workspace UUID.

resolve_workspace_id(workspace: str | UUID | None = None) -> str

Parameters

Name Description
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description

The workspace UUID.

resolve_workspace_name

Resolve the workspace name or ID to the workspace name.

resolve_workspace_name(workspace: str | UUID | None = None) -> str

Parameters

Name Description
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description
str

The workspace name.

run_notebook_job

Run a notebook job and wait for it to complete.

run_notebook_job(notebook_id: str, max_attempts: int = 10, workspace: str | UUID | None = None) -> str

Parameters

Name Description
notebook_id
Required
str

The id of the notebook to run.

max_attempts
int

Maximum number of retries to wait for creation of the notebook.

default value: 10
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

default value: None

Returns

Type Description
str

The job id.