airflow.providers.microsoft.azure.operators.powerbi¶
Classes¶
Construct a link to monitor a dataset in Power BI. |
|
Refreshes a Power BI dataset. |
|
Gets a list of workspaces where the service principal from the connection is assigned as admin. |
|
Gets a list of datasets where the service principal from the connection is assigned as admin. |
Module Contents¶
- class airflow.providers.microsoft.azure.operators.powerbi.PowerBILink[source]¶
Bases:
airflow.providers.common.compat.sdk.BaseOperatorLinkConstruct a link to monitor a dataset in Power BI.
- name = 'Monitor PowerBI Dataset'[source]¶
Name of the link. This will be the button name on the task UI.
- get_link(operator, *, ti_key)[source]¶
Link to external system.
- Parameters:
operator (airflow.providers.common.compat.sdk.BaseOperator) – The Airflow operator object this link is associated to.
ti_key (airflow.providers.common.compat.sdk.TaskInstanceKey) – TaskInstance ID to return link for.
- Returns:
link to external system
- class airflow.providers.microsoft.azure.operators.powerbi.PowerBIDatasetRefreshOperator(*, dataset_id, group_id, conn_id=PowerBIHook.default_conn_name, timeout=60 * 60 * 24 * 7, proxies=None, api_version=None, check_interval=60, request_body=None, wait_for_completion=True, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), **kwargs)[source]¶
Bases:
airflow.providers.common.compat.sdk.ResumableJobMixin,airflow.providers.common.compat.sdk.BaseOperatorRefreshes a Power BI dataset.
The refresh is started from the worker, and its id is kept in the task state store before the task defers to wait for it. A retry, for instance after a worker crash, reconnects to that refresh while it is still in progress, and does not start a new one once it has completed. This needs Airflow 3.3 or later; on older versions every try starts a new refresh.
See also
For more information on how to use this operator, take a look at the guide: PowerBIDatasetRefreshOperator
- Parameters:
dataset_id (str) – The dataset id.
group_id (str) – The workspace id.
conn_id (str) – Airflow Connection ID that contains the connection information for the Power BI account used for authentication.
timeout (float) – Time in seconds to wait for a dataset to reach a terminal status for asynchronous waits.
check_interval (int) – Number of seconds to wait before rechecking the refresh status.
request_body (dict[str, Any] | None) – Additional arguments to pass to the request body, as described in https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/refresh-dataset-in-group#request-body.
wait_for_completion (bool) – If True, wait for the dataset refresh to complete. If False, trigger the refresh and return immediately without waiting.
deferrable (bool) – This parameter is deprecated and no longer has any effect. The operator now always uses deferrable execution.
durable – Reconnect to the refresh started by an earlier try instead of starting a new one (default is True). Needs Airflow 3.3 or later.
- template_fields: collections.abc.Sequence[str] = ('dataset_id', 'group_id')[source]¶
- submit_job(context)[source]¶
Submit the job to the external system. Return its external ID.
The returned ID must not be
None, aNonereturn is treated as “no ID available” and the ID will not be persisted to task state.
- get_job_status(external_id, context)[source]¶
Query the external system for the current job status.
contextis provided so implementations can use it if needed to implement advanced features such as:cache terminal status to
task_state_storewhen the remote resource may be ephemeral (e.g. a K8s driver pod that gets garbage-collected after completion),
- is_job_active(status)[source]¶
Return True if the job is still running and can be reconnected to.
statusis a raw string returned by the external system — not an Airflow enum. Its values are backend-specific (e.g."RUNNING","Pending","ContainerCreating").
- is_job_succeeded(status)[source]¶
Return True if the job completed successfully.
statusis a raw string returned by the external system — not an Airflow enum. Its values are backend-specific (e.g."FINISHED","Succeeded").
- poll_until_complete(external_id, context)[source]¶
Block until the job reaches a terminal state. Raise on failure.
- get_job_result(external_id, context)[source]¶
Return the job result after completion. Return None if not applicable.
- handle_refresh(context, event)[source]¶
Handle refresh-trigger event and optionally defer again to wait for refresh completion.
Only tasks deferred by an earlier version of this provider, whose trigger started the refresh, still resume here.
- Parameters:
context (airflow.sdk.Context) – Airflow context dictionary
event (dict[str, str] | None) – Event dict from trigger with status and dataset_refresh_id
- class airflow.providers.microsoft.azure.operators.powerbi.PowerBIWorkspaceListOperator(*, conn_id=PowerBIHook.default_conn_name, timeout=60 * 60 * 24 * 7, proxies=None, api_version=None, **kwargs)[source]¶
Bases:
airflow.providers.common.compat.sdk.BaseOperatorGets a list of workspaces where the service principal from the connection is assigned as admin.
See also
For more information on how to use this operator, take a look at the guide: PowerBIWorkspaceListOperator
- Parameters:
conn_id (str) – The connection Id to connect to PowerBI.
timeout (float) – The HTTP timeout being used by the KiotaRequestAdapter. Default is 1 week (60s * 60m * 24h * 7d). 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.
- class airflow.providers.microsoft.azure.operators.powerbi.PowerBIDatasetListOperator(*, group_id, conn_id=PowerBIHook.default_conn_name, timeout=60 * 60 * 24 * 7, proxies=None, api_version=None, **kwargs)[source]¶
Bases:
airflow.providers.common.compat.sdk.BaseOperatorGets a list of datasets where the service principal from the connection is assigned as admin.
See also
For more information on how to use this operator, take a look at the guide: PowerBIDatasetListOperator
- Parameters:
conn_id (str) – The connection Id to connect to PowerBI.
group_id (str) – The group Id to list discoverable datasets.
timeout (float) – The HTTP timeout being used by the KiotaRequestAdapter. Default is 1 week (60s * 60m * 24h * 7d). 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.