Dagster & Tableau (Component)
This feature is considered in a beta stage. It is still being tested and may change. For more information, see the API lifecycle stages documentation.
The dagster-tableau library provides a TableauComponent which can be used to easily represent Tableau workbooks, sheets, dashboards, and data sources as assets in Dagster.
TableauComponent is a state-backed component, which fetches and caches Tableau workspace metadata. For information on managing component state, see Configuring state-backed components.
Step 1: Prepare a Dagster project
To begin, you'll need a Dagster project. You can use an existing components-ready project or create a new one:
uvx create-dagster project my-project && cd my-project/src
Activate the project virtual environment:
source ../.venv/bin/activate
Finally, add the dagster-tableau library to the project:
uv add dagster-tableau
Step 2: Scaffold a Tableau component definition
Now that you have a Dagster project, you can scaffold a Tableau component definition:
dg scaffold defs dagster_tableau.TableauComponent tableau_ingest
Creating defs at /.../my-project/src/my_project/defs/tableau_ingest.
The dg scaffold defs call will generate a defs.yaml file:
tree my_project/defs
my_project/defs
├── __init__.py
└── tableau_ingest
└── defs.yaml
2 directories, 2 files
Step 3: Configure your Tableau workspace
Update the defs.yaml file with your Tableau workspace connection details. You'll need to provide your connected app credentials and site information. For more information on creating a connected app, see the Tableau documentation.
The configuration depends on whether you're using Tableau Cloud or Tableau Server:
- Using Dagster with Tableau Cloud
- Using Dagster with Tableau Server
For Tableau Cloud, set type: cloud and provide your pod_name:
type: dagster_tableau.TableauComponent
attributes:
workspace:
type: cloud
connected_app_client_id: "{{ env.TABLEAU_CONNECTED_APP_CLIENT_ID }}"
connected_app_secret_id: "{{ env.TABLEAU_CONNECTED_APP_SECRET_ID }}"
connected_app_secret_value: "{{ env.TABLEAU_CONNECTED_APP_SECRET_VALUE }}"
username: "{{ env.TABLEAU_USERNAME }}"
site_name: "{{ env.TABLEAU_SITE_NAME }}"
pod_name: "{{ env.TABLEAU_POD_NAME }}"
For Tableau Server, set type: server and provide your server_name instead of pod_name:
type: dagster_tableau.TableauComponent
attributes:
workspace:
type: server
connected_app_client_id: '{{ env.TABLEAU_CLIENT_ID }}'
connected_app_secret_id: '{{ env.TABLEAU_SECRET_ID }}'
connected_app_secret_value: '{{ env.TABLEAU_SECRET_VALUE }}'
username: '{{ env.TABLEAU_USERNAME }}'
site_name: my_site
server_name: tableau.example.com
dg list defs
┏━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Section ┃ Definitions ┃
┡━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ Assets │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓ │