Apache Airflow Tableau Provider

5.3.4 · active · verified Sun Apr 12

The Apache Airflow Tableau Provider enables seamless integration between Apache Airflow and Tableau Server/Online. It offers operators and hooks to automate various Tableau-related tasks, such as refreshing data sources, publishing workbooks, and managing server content, directly within Airflow DAGs. The provider is actively maintained as part of the Apache Airflow project, with regular releases aligning with Airflow's provider release cycles, currently at version 5.3.4.

Warnings

Install

Imports

Quickstart

This example DAG demonstrates how to use the `TableauOperator` to refresh a Tableau workbook. It shows a blocking refresh, meaning the task will wait until the refresh operation on Tableau Server/Online is completed. The `tableau_conn_id` parameter references an Airflow connection configured with Tableau credentials. The `site_id` should be provided if not using the default Tableau site, or an empty string ('') for the default site. Workbook ID can be passed via DAG params or environment variables.

import os
from datetime import datetime

from airflow import DAG
from airflow.providers.tableau.operators.tableau import TableauOperator

with DAG(
    dag_id='example_tableau_refresh_workbook',
    start_date=datetime(2023, 1, 1),
    schedule_interval=None,
    catchup=False,
    tags=['tableau', 'example'],
    params={'workbook_id': os.environ.get('AIRFLOW_WORKBOOK_ID', 'your_workbook_id')}
) as dag:
    refresh_workbook_blocking = TableauOperator(
        task_id='refresh_tableau_workbook_blocking',
        resource='workbooks',
        method='refresh',
        find="{{ params.workbook_id }}",
        site_id=os.environ.get('AIRFLOW_TABLEAU_SITE_ID', ''), # Use '' for default site
        blocking_refresh=True, # Waits until refresh is complete
        tableau_conn_id=os.environ.get('AIRFLOW_TABLEAU_CONN_ID', 'tableau_default')
    )

view raw JSON →