Add first-class ThoughtSpot TML Model object support#199
Conversation
ThoughtSpot deprecated the Worksheet object (auto-migrated to Models and removed in 10.12.0.cl). The adapter routed the top-level model: key into the worksheet parser, which only reads worksheet keys, so current TML Model files (export_schema_version v2) imported as empty/incorrect models. - Add _parse_model for the TML Model object: reads model_tables: for tables, model-level columns: for fields, and joins nested inside each model_tables entry via with:/on:/type:/cardinality:. - Map join cardinality (MANY_TO_ONE/ONE_TO_ONE/ONE_TO_MANY/MANY_TO_MANY) to sidemantic relationship types; resolve model_tables aliases used by role-playing dimensions. - Keep _parse_worksheet for legacy worksheet content nested under model:. - Extend loader auto-detection so a model + model_tables + columns .tml/.yaml/.yml file is recognized as ThoughtSpot. - Add sales.model.tml and model_alias.model.tml fixtures plus parsing, alias-resolution, loader auto-detect, and legacy-fallback tests.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3ad8bbcb83
ℹ️ 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".
Model column_id paths reference a table by its name even when the table also has an id (e.g. column_id: orders::amount for a table with id: orders_tbl). _table_name_lookup only mapped id -> name, so those refs missed the lookup and the qualifier was dropped, emitting bare columns like amount/id that are ambiguous in joined model SQL. Map name -> name in addition to id -> name (id mappings take precedence) so column_id qualifiers resolve to table.column.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ede3e1858b
ℹ️ 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".
…ing aliases Joined Model TMLs are exported as derived SQL (FROM (<sql>) AS t) but their dimension/metric SQL kept inner table qualifiers like sales.gross_revenue, which are out of scope in the wrapping subquery and made joined models unqueryable. Rewrite the inner SELECT * into an explicit projection that aliases each table.column to a stable unqualified output name, expose the primary key, and rewrite column SQL to those aliases. Also preserve with: aliases as role identifiers instead of resolving them to the backing table, so role-playing joins (ship_country/bill_country both backed by countries) stay distinct via JOIN countries AS <alias> rather than collapsing into a single ambiguous countries relation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 924af09420
ℹ️ 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".
…ables in joined models
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f9777cd1f
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 14a9a58219
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f1679a77ba
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae95a8f56f
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8829f2f224
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c270e69c11
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f33276de3
ℹ️ 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".
…esolve renamed id keys
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5a590f767b
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e4aaadecf4
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 608e374788
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f4e34cd41b
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 280e05bf8c
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8a23d0d55f
ℹ️ 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
ThoughtSpot deprecated the Worksheet object (disabled by default in 10.4.0.cl, auto-migrated to Models and removed in 10.12.0.cl). The adapter routed the top-level
model:key into the worksheet parser, which only understands worksheet-shaped keys. As a result, current TML Model files (export_schema_versionv2) imported as empty or incorrect models.This adds a dedicated
_parse_modelpath for the TML Model object while keeping the legacy worksheet path intact.Upstream features now supported
model_tables:for table definitions (vs worksheettables:), includingname/id/fqn/alias.columns:for fields (vsworksheet_columns:), resolvingcolumn_id: <table>::<column>totable.column, including formula-backed columns viaformula_id/formulas:.model_tablesentry underjoins:, usingwith:/on:/type:/cardinality:. The bareon:key (parsed by PyYAML as booleanTrue) is handled.MANY_TO_ONE/ONE_TO_ONE/ONE_TO_MANY/MANY_TO_MANYto sidemantic relationship types, instead of the worksheetis_one_to_oneflag.model_tablesentryaliasused incolumn_idpaths and joinwithrefs resolves back to the underlying table.model+model_tables+columns.tml/.yaml/.ymlfile is now recognized as ThoughtSpot.Backward compatibility
Legacy Worksheet/Table TML is unchanged. Worksheet content nested under
model:(withoutmodel_tables/columns) still routes to_parse_worksheet. Existing fixtures and tests stay green.Known limitations