Airflow Summit 2025 is coming October 07-09. Register now for early bird ticket!

airflow.providers.microsoft.azure.hooks.powerbi

Exceptions

PowerBIDatasetRefreshException

An exception that indicates a dataset refresh failed to complete.

PowerBIWorkspaceListException

An exception that indicates a failure in getting the list of groups (workspaces).

PowerBIDatasetListException

An exception that indicates a failure in getting the list of datasets.

Classes

PowerBIDatasetRefreshFields

Power BI refresh dataset details.

PowerBIDatasetRefreshStatus

Power BI refresh dataset statuses.

PowerBIHook

A async hook to interact with Power BI.

Module Contents

class airflow.providers.microsoft.azure.hooks.powerbi.PowerBIDatasetRefreshFields[source]

Bases: enum.Enum

Power BI refresh dataset details.

REQUEST_ID = 'request_id'[source]
STATUS = 'status'[source]
ERROR = 'error'[source]
class airflow.providers.microsoft.azure.hooks.powerbi.PowerBIDatasetRefreshStatus[source]

Power BI refresh dataset statuses.

IN_PROGRESS = 'In Progress'[source]
FAILED = 'Failed'[source]
COMPLETED = 'Completed'[source]
DISABLED = 'Disabled'[source]
TERMINAL_STATUSES[source]
FAILURE_STATUSES[source]
exception airflow.providers.microsoft.azure.hooks.powerbi.PowerBIDatasetRefreshException[source]

Bases: airflow.exceptions.AirflowException

An exception that indicates a dataset refresh failed to complete.

exception airflow.providers.microsoft.azure.hooks.powerbi.PowerBIWorkspaceListException[source]

Bases: airflow.exceptions.AirflowException

An exception that indicates a failure in getting the list of groups (workspaces).

exception airflow.providers.microsoft.azure.hooks.powerbi.PowerBIDatasetListException[source]

Bases: airflow.exceptions.AirflowException

An exception that indicates a failure in getting the list of datasets.

class airflow.providers.microsoft.azure.hooks.powerbi.PowerBIHook(conn_id=default_conn_name, proxies=None, timeout=60 * 60 * 24 * 7, api_version=None)[source]

Bases: airflow.providers.microsoft.azure.hooks.msgraph.KiotaRequestAdapterHook

A async hook to interact with Power BI.

Parameters:
  • conn_id (str) – The connection Id to connect to PowerBI.

  • timeout (float) – The HTTP timeout being used by the KiotaRequestAdapter (default is None). When no timeout is specified or set to None then there is no HTTP timeout on each request.

  • proxies (dict | None) – A dict defining the HTTP proxies to be used (default is None).

  • api_version (msgraph_core.APIVersion | str | None) – The API version of the Microsoft Graph API to be used (default is v1). You can pass an enum named APIVersion which has 2 possible members v1 and beta, or you can pass a string as v1.0 or beta.

conn_type: str = 'powerbi'[source]
conn_name_attr: str = 'conn_id'[source]
default_conn_name: str = 'powerbi_default'[source]
hook_name: str = 'Power BI'[source]
classmethod get_connection_form_widgets()[source]

Return connection widgets to add to connection form.

classmethod get_ui_field_behaviour()[source]

Return custom field behaviour.

async get_refresh_history(dataset_id, group_id)[source]

Retrieve the refresh history of the specified dataset from the given group ID.

Parameters:
  • dataset_id (str) – The dataset ID.

  • group_id (str) – The workspace ID.

Returns:

Dictionary containing all the refresh histories of the dataset.

Return type:

list[dict[str, str]]

classmethod raw_to_refresh_details(refresh_details)[source]

Convert raw refresh details into a dictionary containing required fields.

Parameters:

refresh_details (dict) – Raw object of refresh details.

async get_refresh_details_by_refresh_id(dataset_id, group_id, refresh_id)[source]

Get the refresh details of the given request Id.

Parameters:

refresh_id (str) – Request Id of the Dataset refresh.

async trigger_dataset_refresh(*, dataset_id, group_id)[source]

Triggers a refresh for the specified dataset from the given group id.

Parameters:
  • dataset_id (str) – The dataset id.

  • group_id (str) – The workspace id.

Returns:

Request id of the dataset refresh request.

Return type:

str

async get_workspace_list()[source]

Triggers a request to get all available workspaces for the service principal.

Returns:

List of workspace IDs.

Return type:

list[str]

async get_dataset_list(*, group_id)[source]

Triggers a request to get all datasets within a group (workspace).

Parameters:

group_id (str) – Workspace ID.

Returns:

List of dataset IDs.

Return type:

list[str]

async cancel_dataset_refresh(dataset_id, group_id, dataset_refresh_id)[source]

Cancel the dataset refresh.

Parameters:
  • dataset_id (str) – The dataset Id.

  • group_id (str) – The workspace Id.

  • dataset_refresh_id (str) – The dataset refresh Id.

Was this entry helpful?