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:
Create necessary resources using AZURE PORTAL or AZURE CLI.
Install API libraries via pip.
pip install 'apache-airflow[azure]'Detailed information is available Installation of Airflow®
PowerBIDatasetRefreshOperator¶
To trigger a refresh for the specified dataset from the specified workspace, use the PowerBIDatasetRefreshOperator.
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. Set durable=False to
start a new refresh on every try. Durable execution requires Airflow 3.3 or newer.
PowerBIDatasetListOperator¶
To list all available and discoverable datasets from the specified workspace, use the PowerBIDatasetListOperator.
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.
get_powerbi_workspace_list = PowerBIWorkspaceListOperator(
conn_id="powerbi_default",
task_id="get_powerbi_workspace_list",
timeout=120,
)
Reference¶
For further information, look at: