feat(tableau): support extended relation types, semantic-layer attrs, spatial datatype#208
Conversation
… spatial datatype
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5db4aa72c2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…-level subqueries Single-member union/batch-union relations resolved to a bare 'SELECT * FROM <source>' string stored on model.table, which the SQL generator emits verbatim, producing the invalid 'FROM SELECT * FROM ...'. Store the resolved union SQL on model.sql instead so it is wrapped as '(<sql>) AS t'. Top-level type='subquery' relations stored '(<select>) AS <alias>' on model.sql, which the generator re-wrapped as '((<select>) AS <alias>) AS t', an invalid double-aliased derived table. Strip the outer alias before storing so the generator supplies the single alias. Add regression tests asserting both paths compile to DuckDB-valid SQL.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4d20522e79
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…literals when stripping derived aliases Top-level type="pivot" relations resolved to the raw wide child table, so generated queries selected the pivot output columns (Pivot Field Names / Pivot Field Values) from a table where they do not exist. Emit DuckDB UNPIVOT derived SQL over the declared wide source columns instead, storing it on model.sql so the model is queryable. Falls back to the child table only when source columns are not declared. _strip_derived_alias scanned parentheses without tracking SQL string literals, so a subquery body like SELECT ')' AS amount terminated the scan early and left the outer alias attached, producing an invalid double-aliased derived table. Skip single- and double-quoted spans (with doubled-quote escapes) during the scan.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: feb09d9e47
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
What changed
Extends the Tableau adapter (
sidemantic/adapters/tableau.py) to handle physical-layer relation types and modeling attributes that previously fell through to no-ops, plus the geospatial datatype.Physical-layer relation types
Beyond the existing
table/join/text/collectionhandling, the adapter now recognizes:unionandbatch-union— member relations are stacked vertically and compiled toUNION ALLSQL (Tableau unions keep duplicate rows). A single-member union degrades gracefully to a plain table reference.subquery— wrapped as a derived subquery, mirroring the existingtext(custom SQL) path.stored-proc— resolved to the stored procedure's actual name (<actual-name>/stored-procattribute); stored procedures cannot be joined or unioned in Tableau, so they map to a single table reference.pivot,project,text-transform— column-reshaping wrapper relations that keep a single-table grain; resolved to the wrapped child relation's base table or SQL.These are wired into both the top-level connection relation dispatch and the recursive
_parse_relation_tree, so the new types also compose inside join trees.Tableau Semantics object-graph attributes
The
<object-graph>element'ssemantic-layerandis-legacyattributes (Tableau Semantics layer) are now read and surfaced as model metadata (tableau_semantic_layer,tableau_is_legacy), tolerant of namespace-prefixed forms. This lets consumers distinguish modern semantic models from legacy object models. Relationship extraction is unchanged.Spatial datatype
The
spatialdatatype (Tableau'sTABLEAU.TABGEOGRAPHYgeospatial columns) is mapped to acategoricaldimension, since geospatial columns group/filter rather than aggregate numerically.Tests / fixtures
Added
tests/adapters/tableau/test_relation_types.pyand eight.tdsfixtures undertests/fixtures/tableau/(one per relation type plus spatial and the semantic-layer object-graph). All existing Tableau tests remain green; backward compatibility is preserved.Known limitations
SELECT *per member; Tableau's column-alignment/coercion metadata for mismatched unions is not reconstructed.pivot/text-transformreshaping logic is not replayed — the adapter resolves to the wrapped source table and imports the reshaped output columns from<metadata-records>, rather than synthesizing the transform SQL.stored-procparameters are not modeled.