# Tableau

Create a live connection or extract in [Tableau](https://www.tableau.com) using the engine that reads your Send2Bucket data. Expose the JSON fields you want to chart as columns in a view so they appear in Tableau’s field list.

| You have | Tableau connector |
|---|---|
| Athena over the bucket or S3 Tables | **Amazon Athena** |
| BigQuery | **Google BigQuery** |
| Trino or Starburst | **Starburst Enterprise**, with the Trino JDBC driver |
| [Snowflake](../../querying/snowflake.md) | **Snowflake** |
| Redshift | **Amazon Redshift** |
| Records loaded into PostgreSQL | **PostgreSQL** |
| MotherDuck | **PostgreSQL**, to MotherDuck's Postgres endpoint, or the DuckDB JDBC driver |

## Flat views

Create one view per signal in the engine, with the fields people chart as columns. Tableau then sees typed dimensions and measures. For example, in [Athena](../../querying/athena.md) or [Trino](../../querying/trino.md), over the Iceberg table:

```sql
CREATE VIEW s2b.events_flat AS
SELECT ingested_at,
       json_extract_scalar(payload, '$.data.event') AS event,
       json_extract_scalar(payload, '$.data.user_id') AS user_id,
       CAST(json_extract_scalar(payload, '$.data.cents') AS bigint) AS cents
FROM s2b.events
WHERE signal_type = 'event';
```

In [PostgreSQL](../../querying/postgres.md), use the `s2b_events` view from [Metabase](./metabase.md#postgresql-or-mysql). In [BigQuery](../../querying/bigquery.md), use `JSON_VALUE` on `s2b.records` in the same way. Grant the Tableau user `SELECT` on the views only.

For a one-off analysis, **New Custom SQL** in the data source pane accepts any query from the engine page instead.

## Connectors

- **Amazon Athena**: install the Athena JDBC driver into Tableau's `Drivers` folder. The connection needs the Athena endpoint for your region, the S3 staging directory for query results, and an access key or IAM role that can run queries in the workgroup and read the Send2Bucket prefix. Every refresh of a live connection runs Athena queries that scan data, so filter on `date` and prefer extracts for dashboards over many days.
- **Google BigQuery**: sign in with a Google account or a service account key that has BigQuery Data Viewer on the `s2b` dataset and BigQuery Job User on the billing project.
- **Starburst Enterprise**: works with Trino too. Put the Trino JDBC driver JAR in Tableau's `Drivers` folder and keep only one Trino JDBC version there. Fill in host, port (443 with TLS), catalog and schema, and a read-only user.
- **Snowflake**, **Amazon Redshift**, **PostgreSQL**: built in. Use a role or user with `SELECT` on the Send2Bucket views only. See [Redshift](../../querying/redshift.md) and [PostgreSQL](../../querying/postgres.md) for the tables.

## DuckDB and MotherDuck

For views kept in [MotherDuck](../motherduck.md):

- **Tableau Cloud**: add a **PostgreSQL** connection to MotherDuck's Postgres endpoint, with a read-scoped MotherDuck token as the password. Queries are DuckDB SQL, so the [DuckDB example queries](../../querying/duckdb.md#example-queries) work as Custom SQL.
- **Tableau Desktop and Server**: MotherDuck documents a setup with the DuckDB JDBC driver and a Tableau connector file, which also reads a local DuckDB database file. Follow [MotherDuck's Tableau guide](https://motherduck.com/docs/integrations/bi-tools/tableau/) for the current driver and connector versions.

## Notes

- A **Live** connection queries the engine every time a view is opened or filtered. An **Extract** copies the result into Tableau and refreshes on the schedule you set in Tableau Cloud or Tableau Server. For bucket destinations, which are slow to scan, extracts on a schedule cost less and load faster.
- Tableau Cloud reaches databases on the public internet. For an engine inside a private network, use Tableau Bridge.
- OTLP attributes are lists of key and value pairs and timestamps are nanosecond strings. Extract them in the view, as in the engine pages, not in Tableau calculations.
