airflow.providers.tableau.hooks.tableau
¶
Module Contents¶
-
exception
airflow.providers.tableau.hooks.tableau.
TableauJobFailedException
[source]¶ Bases:
airflow.exceptions.AirflowException
An exception that indicates that a Job failed to complete.
-
class
airflow.providers.tableau.hooks.tableau.
TableauJobFinishCode
[source]¶ Bases:
enum.Enum
The finish code indicates the status of the job. .. seealso:: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#query_job
-
class
airflow.providers.tableau.hooks.tableau.
TableauHook
(site_id: Optional[str] = None, tableau_conn_id: str = default_conn_name)[source]¶ Bases:
airflow.hooks.base.BaseHook
Connects to the Tableau Server Instance and allows to communicate with it.
Can be used as a context manager: automatically authenticates the connection when opened and signs out when closed.
- Parameters
site_id (Optional[str]) -- The id of the site where the workbook belongs to. It will connect to the default site if you don't provide an id.
tableau_conn_id (str) -- The Tableau Connection id containing the credentials to authenticate to the Tableau Server.
-
get_conn
(self)[source]¶ Sign in to the Tableau Server.
- Returns
an authorized Tableau Server Context Manager object.
- Return type
tableauserverclient.server.Auth.contextmgr
-
get_all
(self, resource_name: str)[source]¶ Get all items of the given resource. .. see also:: https://tableau.github.io/server-client-python/docs/page-through-results
- Parameters
resource_name (str) -- The name of the resource to paginate. For example: jobs or workbooks.
- Returns
all items by returning a Pager.
- Return type
tableauserverclient.Pager
-
get_job_status
(self, job_id: str)[source]¶ Get the current state of a defined Tableau Job. .. see also:: https://tableau.github.io/server-client-python/docs/api-ref#jobs
- Parameters
job_id (str) -- The id of the job to check.
- Returns
An Enum that describe the Tableau job’s return code
- Return type
-
wait_for_state
(self, job_id: str, target_state: TableauJobFinishCode, check_interval: float)[source]¶ Wait until the current state of a defined Tableau Job is equal to target_state or different from PENDING.
- Parameters
job_id (str) -- The id of the job to check.
target_state (TableauJobFinishCode) -- Enum that describe the Tableau job’s target state
check_interval (float) -- time in seconds that the job should wait in between each instance state checks until operation is completed
- Returns
return True if the job is equal to the target_status, False otherwise.
- Return type