PowerBIDatasetRefreshSensor¶
Sensor for polling the status of a previously triggered Power BI dataset refresh.
- class PowerBI_Operator.sensors.powerbi_refresh_dataset_sensor.PowerBIDatasetRefreshSensor(conn_id, dataset_id: str, group_id: str, xcom_task_id=None, *args, **kwargs)¶
Bases:
BaseSensorOperatorPolls a Power BI dataset refresh, started by an upstream task, until it terminates.
The refresh request id is read from XCom, pushed by the upstream task (typically a
PowerBIDatasetRefreshOperatorrun withwait_for_termination=False) under the keypowerbi_dataset_refresh_id.- Parameters:
conn_id – Airflow connection id holding the Power BI service principal credentials.
dataset_id – The dataset id.
group_id – The workspace id.
xcom_task_id – Task id of the upstream task that pushed the refresh request id to XCom.
Example:
PowerBIDatasetRefreshSensor( task_id="wait_for_refresh", conn_id="powerbi_default", dataset_id="abc123", group_id="def456", xcom_task_id="refresh_dataset", )
- poke(context)¶
Check whether the dataset refresh has reached a terminal status.
Pushes the terminal status to XCom under
powerbi_dataset_refresh_statusand raisesPowerBIDatasetRefreshExceptionif the refresh failed.- Parameters:
context – Airflow task instance context, used to pull the refresh request id from XCom.
- Returns:
Trueonce the refresh has reached a terminal status (FailedorCompleted).