---
title: "Tableau data sources using custom SQL | Metacenta"
description: "Custom SQL in a Tableau data source is transformation logic nobody tests and lineage cannot see. How to move it upstream, and when it does little harm."
url: "https://metacenta.com/rules/tableau-custom-sql"
updated: "2026-10-14"
tokens: 504
---

BI semantic layer · rule tableau-custom-sql

# Tableau data sources using custom SQL

A Metacenta review checks this under the rule **Tableau data sources read tables, not custom SQL**. Everything below applies whether or not you ever commission one.

## What this rule checks

This rule flags each Tableau data source with one or more custom SQL relations. We count the queries; we never keep their text. A data source that reads only tables passes.

## Why it matters

Transformation logic in the BI layer is untested and invisible to the pipeline's lineage. A change to an upstream table can break the query, and nothing warns anyone first.

## How to fix it

**Move Tableau custom SQL into the pipeline.** Move the logic into a modelled table and point the data source at it. If the query only selects and renames columns, a plain table relation does the same.

## When it is fine to leave

A prototype workbook that will be rebuilt on modelled tables, or a projection of one modelled table. The rule is low severity for that reason: custom SQL is sometimes a stopgap.

## What we need to check it

Tableau workbooks: `.twb` files, or the `.twb` inside a `.twbx`. We keep data source names, the tables each reads and a count of custom SQL relations. Connection details and the SQL text are dropped.

[Ask about a review](https://metacenta.com/enquire?src=rule-tableau-custom-sql&via=md)

## Related pages

- [dbt semantic models reading unbuilt columns](https://metacenta.com/rules/semantic-column-not-built)
- [dbt semantic model keys with no unique test](https://metacenta.com/rules/semantic-primary-entity-unasserted)
- [Looker views reading tables dbt does not know](https://metacenta.com/rules/lookml-view-unbuilt-table)
- [Looker views reading raw dbt sources](https://metacenta.com/rules/lookml-view-reads-raw-source)
- [A sample review, as a client reads it](https://metacenta.com/sample)
- [All published rules](https://metacenta.com/rules)
- [How a review is assessed](https://metacenta.com/standard)
