| :py:mod:`airflow.providers.tableau.hooks.tableau` |
| ================================================= |
| |
| .. py:module:: airflow.providers.tableau.hooks.tableau |
| |
| |
| Module Contents |
| --------------- |
| |
| Classes |
| ~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.providers.tableau.hooks.tableau.TableauJobFinishCode |
| airflow.providers.tableau.hooks.tableau.TableauHook |
| |
| |
| |
| Functions |
| ~~~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.providers.tableau.hooks.tableau.parse_boolean |
| |
| |
| |
| .. py:function:: parse_boolean(val) |
| |
| Try to parse a string into boolean. |
| |
| The string is returned as-is if it does not look like a boolean value. |
| |
| |
| .. py:exception:: TableauJobFailedException |
| |
| Bases: :py:obj:`airflow.exceptions.AirflowException` |
| |
| An exception that indicates that a Job failed to complete. |
| |
| |
| .. py:class:: TableauJobFinishCode |
| |
| Bases: :py:obj:`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 |
| |
| .. py:attribute:: PENDING |
| |
| |
| |
| |
| .. py:attribute:: SUCCESS |
| :annotation: = 0 |
| |
| |
| |
| .. py:attribute:: ERROR |
| :annotation: = 1 |
| |
| |
| |
| .. py:attribute:: CANCELED |
| :annotation: = 2 |
| |
| |
| |
| |
| .. py:class:: TableauHook(site_id = None, tableau_conn_id = default_conn_name) |
| |
| Bases: :py:obj:`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. |
| |
| .. seealso:: https://tableau.github.io/server-client-python/docs/ |
| |
| :param site_id: The id of the site where the workbook belongs to. |
| It will connect to the default site if you don't provide an id. |
| :param tableau_conn_id: The :ref:`Tableau Connection id <howto/connection:tableau>` |
| containing the credentials to authenticate to the Tableau Server. |
| |
| .. py:attribute:: conn_name_attr |
| :annotation: = tableau_conn_id |
| |
| |
| |
| .. py:attribute:: default_conn_name |
| :annotation: = tableau_default |
| |
| |
| |
| .. py:attribute:: conn_type |
| :annotation: = tableau |
| |
| |
| |
| .. py:attribute:: hook_name |
| :annotation: = Tableau |
| |
| |
| |
| .. py:method:: __enter__(self) |
| |
| |
| .. py:method:: __exit__(self, exc_type, exc_val, exc_tb) |
| |
| |
| .. py:method:: get_conn(self) |
| |
| Sign in to the Tableau Server. |
| |
| :return: an authorized Tableau Server Context Manager object. |
| :rtype: tableauserverclient.server.Auth.contextmgr |
| |
| |
| .. py:method:: get_all(self, resource_name) |
| |
| Get all items of the given resource. |
| .. see also:: https://tableau.github.io/server-client-python/docs/page-through-results |
| |
| :param resource_name: The name of the resource to paginate. |
| For example: jobs or workbooks. |
| :return: all items by returning a Pager. |
| :rtype: tableauserverclient.Pager |
| |
| |
| .. py:method:: get_job_status(self, job_id) |
| |
| Get the current state of a defined Tableau Job. |
| .. see also:: https://tableau.github.io/server-client-python/docs/api-ref#jobs |
| |
| :param job_id: The id of the job to check. |
| :return: An Enum that describe the Tableau job’s return code |
| :rtype: TableauJobFinishCode |
| |
| |
| .. py:method:: wait_for_state(self, job_id, target_state, check_interval) |
| |
| Wait until the current state of a defined Tableau Job is equal |
| to target_state or different from PENDING. |
| |
| :param job_id: The id of the job to check. |
| :param target_state: Enum that describe the Tableau job’s target state |
| :param check_interval: time in seconds that the job should wait in |
| between each instance state checks until operation is completed |
| :return: return True if the job is equal to the target_status, False otherwise. |
| :rtype: bool |
| |
| |
| |