Back to integrations
Using Dagster with Tableau

Dagster Integration:
Using Dagster with Tableau

The Tableau integration allows you to monitor your Tableau workspace as assets in Dagster, along with other data assets.

About this integration

Dagster allows you to represent your Tableau workspace as assets, alongside other your other technologies like dbt and Sling. This allows you to see how your Tableau assets are connected to your other data assets, and how changes to other data assets might impact your Tableau workspace. This also enables you to orchestrate the refreshing of your workbooks, ensuring your Tableau workspace reflects the most current data from upstream sources.

Installation

pip install dagster-tableau

Example

from dagster_tableau import (
    TableauCloudWorkspace,
    build_tableau_materializable_assets_definition,
    load_tableau_asset_specs,
)

import dagster as dg

tableau_workspace = TableauCloudWorkspace(
    connected_app_client_id=dg.EnvVar("TABLEAU_CONNECTED_APP_CLIENT_ID"),
    connected_app_secret_id=dg.EnvVar("TABLEAU_CONNECTED_APP_SECRET_ID"),
    connected_app_secret_value=dg.EnvVar("TABLEAU_CONNECTED_APP_SECRET_VALUE"),
    username=dg.EnvVar("TABLEAU_USERNAME"),
    site_name=dg.EnvVar("TABLEAU_SITE_NAME"),
    pod_name=dg.EnvVar("TABLEAU_POD_NAME"),
)

# Load Tableau asset specs
tableau_specs = load_tableau_asset_specs(
    workspace=tableau_workspace,
)

external_asset_specs = [
    spec
    for spec in tableau_specs
    if spec.tags.get("dagster-tableau/asset_type") == "data_source"
]

materializable_asset_specs = [
    spec
    for spec in tableau_specs
    if spec.tags.get("dagster-tableau/asset_type") in ["dashboard", "sheet"]
]

# Use the asset definition builder to construct the definition for tableau materializable assets
defs = dg.Definitions(
    assets=[
        build_tableau_materializable_assets_definition(
            resource_key="tableau",
            specs=materializable_asset_specs,
            refreshable_workbook_ids=["b75fc023-a7ca-4115-857b-4342028640d0"],
        ),
        *external_asset_specs,
    ],
    resources={"tableau": tableau_workspace},
)

About Tableau

Tableau is a modern platform for data analytics and visualization. Tableau integrates with various data sources and can be used to create interactive workbooks, sheets and dashboards.