Microsoft Power BI Operators

Microsoft Power BI, is a unified, scalable platform for self-service and enterprise business intelligence(BI).

Prerequisite Tasks

To use these operators, you must do a few things:

PowerBIDatasetRefreshOperator

To trigger a refresh for the specified dataset from the specified workspace, use the PowerBIDatasetRefreshOperator.

tests/system/microsoft/azure/example_powerbi_dataset_refresh.py[source]

    refresh_powerbi_dataset = PowerBIDatasetRefreshOperator(
        conn_id="powerbi_default",
        task_id="refresh_powerbi_dataset",
        dataset_id=DATASET_ID,
        group_id=GROUP_ID,
        check_interval=30,
        timeout=120,
        request_body={
            "type": "full",
            "retryCount": 3,
            "commitMode": "transactional",
            "notifyOption": "MailOnFailure",
        },
    )

Durable execution

The operator is durable by default: it starts the refresh from the worker and keeps its id in the task state store before it defers. A retry reconnects to a refresh that is still in progress and does not start a new one once it has completed. A refresh that failed, or that is no longer in the dataset’s refresh history, is started again. Durable execution requires Airflow 3.3 or newer.

Two things differ from earlier versions of the provider when the operator is durable:

  • The refresh is started by the worker, so the workers need network access to api.powerbi.com too. The triggerer still polls the refresh.

  • The refresh is not cancelled when polling it fails, so the retry can reconnect to it.

Set durable=False to keep the earlier behaviour: the trigger starts the refresh, so only the triggerer talks to Power BI, every try starts a new refresh, and it is cancelled when polling fails. Below Airflow 3.3 the operator behaves as with durable=False.

PowerBIDatasetListOperator

To list all available and discoverable datasets from the specified workspace, use the PowerBIDatasetListOperator.

tests/system/microsoft/azure/example_powerbi_dataset_list.py[source]

    get_powerbi_dataset_list = PowerBIDatasetListOperator(
        conn_id="powerbi_default",
        task_id="get_powerbi_dataset_list",
        group_id=GROUP_ID,
        timeout=120,
    )

PowerBIWorkspaceListOperator

To list all available and discoverable workspaces for the tenant, use the PowerBIWorkspaceListOperator.

tests/system/microsoft/azure/example_powerbi_workspace_list.py[source]

    get_powerbi_workspace_list = PowerBIWorkspaceListOperator(
        conn_id="powerbi_default",
        task_id="get_powerbi_workspace_list",
        timeout=120,
    )

Reference

For further information, look at:

Was this entry helpful?