airflow.providers.tableau.hooks.tableau

Module Contents

Classes

TableauJobFinishCode

The finish code indicates the status of the job.

TableauHook

Connects to the Tableau Server Instance and allows to communicate with it.

Functions

parse_boolean(val)

Try to parse a string into boolean.

airflow.providers.tableau.hooks.tableau.parse_boolean(val)[source]

Try to parse a string into boolean.

The string is returned as-is if it does not look like a boolean value.

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

PENDING[source]
SUCCESS = 0[source]
ERROR = 1[source]
CANCELED = 2[source]
class airflow.providers.tableau.hooks.tableau.TableauHook(site_id=None, tableau_conn_id=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.

conn_name_attr = tableau_conn_id[source]
default_conn_name = tableau_default[source]
conn_type = tableau[source]
hook_name = Tableau[source]
__enter__(self)[source]
__exit__(self, exc_type, exc_val, exc_tb)[source]
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)[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)[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

TableauJobFinishCode

wait_for_state(self, job_id, target_state, check_interval)[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

bool

Was this entry helpful?