Apache Airflow Tableau Provider

raw JSON →
5.3.4 verified Fri May 15 auth: no python

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.

pip install apache-airflow-providers-tableau
cli airflow
error ModuleNotFoundError: No module named 'airflow.providers.tableau'
cause This error occurs when the 'apache-airflow-providers-tableau' package is not installed in your environment.
fix
Install the package using pip: 'pip install apache-airflow-providers-tableau'.
error ImportError: cannot import name 'TableauHook' from 'airflow.providers.tableau.hooks.tableau'
cause This error occurs when attempting to import 'TableauHook' from an incorrect module path.
fix
Ensure the correct import statement: 'from airflow.providers.tableau.hooks.tableau import TableauHook'.
error AttributeError: module 'airflow.providers.tableau.hooks.tableau' has no attribute 'TableauHook'
cause This error occurs when the 'TableauHook' class is not found in the specified module, possibly due to version incompatibility.
fix
Verify that you have the correct version of 'apache-airflow-providers-tableau' installed and that 'TableauHook' is available in that version.
error AirflowException: Resource not found! Available Resources: ['datasources', 'groups', 'projects', 'schedule', 'sites', 'subscriptions', 'tasks', 'users', 'workbooks']
cause This error occurs when an invalid resource name is provided to the 'TableauOperator'.
fix
Use one of the available resources listed in the error message when initializing the 'TableauOperator'.
error AirflowException: Method not found! Available methods for workbooks: ['delete', 'refresh']
cause This error occurs when an invalid method is specified for a given resource in the 'TableauOperator'.
fix
Use one of the available methods listed in the error message for the specified resource.
deprecated Authentication by personal access token (PAT) is officially deprecated in provider version 2.1.0 and later due to concurrency issues. Tableau automatically invalidates PATs if multiple parallel connections use the same token, leading to job failures.
fix Migrate to JSON Web Token (JWT) authentication for robust and scalable Airflow-Tableau integrations, especially in environments with parallel tasks.
breaking Provider version 4.0.0 removed deprecated classes paths, specifically `tableau_job_status` and `tableau_refresh_workbook`.
fix Update imports and usage to the current `TableauOperator` and `TableauJobStatusSensor` patterns, which now handle these functionalities directly.
breaking Provider version 3.0.0 requires Apache Airflow 2.2.0 or newer. Installing this provider version on older Airflow instances may automatically upgrade Airflow.
fix Ensure your Apache Airflow instance is upgraded to at least version 2.2.0 (or newer for later provider versions) before installing or upgrading to `apache-airflow-providers-tableau` >= 3.0.0.
gotcha Failure to provide the correct `site_id` for Tableau Online or a non-default Tableau Server site can lead to `NotSignedInError: Missing site ID` errors, even if other credentials are correct.
fix Always specify the `site_id` parameter in your Tableau connection or operator if you are not using the default Tableau Server site. For the default site, use an empty string (e.g., `site_id=''`).
gotcha Using self-signed SSL certificates can result in `SSLCertVerificationError` even if `openssl s_client` validates the certificate, indicating potential deeper issues with how `tableauserverclient` handles custom CA bundles within Airflow.
fix Ensure the certificate chain is correctly configured and accessible by the Airflow worker. If possible, use publicly recognized certificates. For self-signed certificates, ensure the full chain is provided and consider alternative verification methods if the issue persists.
python os / libc status wheel install import disk mem side effects
3.10 alpine (musl) wheel - 5.23s 246.5M 71.2M clean
3.10 slim (glibc) wheel 25.0s 3.53s 244M 71.2M clean
3.11 alpine (musl) wheel - 6.37s 266.8M 77.4M clean
3.11 slim (glibc) wheel 23.7s 5.87s 265M 77.4M clean
3.12 alpine (musl) wheel - 5.85s 256.9M 76.1M clean
3.12 slim (glibc) wheel 18.1s 6.12s 256M 76.1M clean
3.13 alpine (musl) wheel - 5.29s 258.7M 76.8M clean
3.13 slim (glibc) wheel 18.5s 5.48s 258M 76.8M clean
3.9 alpine (musl) sdist - - 213.4M - broken
3.9 slim (glibc) wheel 28.9s - 209M - broken

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')
    )