PowerBIHook¶
Hook for triggering and monitoring Power BI dataset refreshes.
- class PowerBI_Operator.hooks.powerbi_hook.PowerBIHook(conn_id: str, dataset_id: str, group_id: str)¶
Bases:
BaseHookA hook to interact with Power BI.
- Parameters:
dataset_id – The dataset id.
group_id – The workspace id.
- get_latest_refresh_details() PowerBiDatasetRefreshDetails | None¶
Get the refresh details of the most recent dataset refresh in the refresh history of the data source.
- Returns:
Dictionary containing refresh status and end time if refresh history exists,
otherwise None. :rtype: dict or None
- get_refresh_details_by_request_id(request_id: str) PowerBiDatasetRefreshDetails¶
Get the refresh details of the given request Id.
- Parameters:
request_id – Request Id of the Dataset refresh.
- get_refresh_history(dataset_id: str, group_id: str) dict¶
Returns the refresh history of the specified dataset from the given group id.
- Parameters:
dataset_id – The dataset id.
group_id – The workspace id.
- Returns:
dict object containaing all the refresh histories of the dataset.
- static raw_to_refresh_details(refresh_details: dict) PowerBiDatasetRefreshDetails¶
Convert raw refresh details into a dictionary containing required fields.
- Parameters:
refresh_details – Raw object of refresh details.
- refresh_dataset(dataset_id: str, group_id: str) str¶
Triggers a refresh for the specified dataset from the given group id.
- Parameters:
dataset_id – The dataset id.
group_id – The workspace id.
- Returns:
Request id of the dataset refresh request.
- trigger_dataset_refresh(wait_for_termination: bool) str¶
Triggers the Power BI dataset refresh.
- Parameters:
wait_for_termination – Wait until the refresh completes before exiting.
- wait_for_dataset_refresh_status(*, expected_status: str, request_id: str, check_interval: int = 60, timeout: int = 604800) bool¶
Wait until the dataset refresh of given request id has reached the expected status.
- Parameters:
expected_status – The desired status to check against a dataset refresh’s current status.
request_id – Request id for the dataset refresh request.
check_interval – Time in seconds to check on a dataset refresh’s status.
timeout – Time in seconds to wait for a dataset to reach a terminal status or the expected status.
- Returns:
Boolean indicating if the dataset refresh has reached the
expected_statusbefore the timeout.