Skip to content

Add a ThoughtSpot subfolder to bi-sql-examples #436

Description

@djwaldo

bi-sql-examples/ currently has one subfolder, tableau/. I would like to add a
thoughtspot/ sibling on the same pattern: real SQL that ThoughtSpot generated while
querying metrics defined outside the tool, in a warehouse-native semantic layer.

Opening this before the PR per CONTRIBUTING.md, so the approach and scope can be
discussed. The work is done and ready to submit — happy to reshape it.

What it would add

  • setup.sql — a six-table star, a Databricks Metric View over it, and a Snowflake
    Semantic View over the same star so the two vendors' expressions sit side by side.
  • Eight .sql files, 26 captured queries grouped by feature area: string predicates,
    date filters and grains, top-N and sub-selects, LoD / two-stage aggregation,
    period-over-period, formulas and parameters, scalar and string functions, result shape.
  • A README.md covering provenance and how to read the captures.

No data ships. The queries are reproduced for their SQL shape, not their results.

How it differs from tableau/

Two things, both worth flagging because they diverge from the existing folder's
conventions:

  1. setup.sql is runnable, where the Tableau one opens "This file is NOT meant to be
    run." Its Databricks half creates the star and the metric view. Its Snowflake half is a
    definition for comparison against a database it does not create, so the file is two
    dialects and is not meant to run end to end on one engine.
  2. Two semantic layers rather than one. That is deliberate: the most useful thing in
    the capture set is that the same measure is declared as a dimension on one layer and a
    metric on the other, and the two return different numbers under a filter with no error
    raised.

Provenance

No SQL was written by hand. Saved Answers were captured through
POST /api/rest/2.0/metadata/answer/sql; the four AgentQL cases were compiled by the same
generator. Each statement is byte-identical to its capture apart from three edits
disclosed in the README, and every statement was executed against a metric view rebuilt
from the proposed setup.sql to confirm it is valid and not merely faithful.

Questions for reviewers

  • Is a second subfolder on this pattern wanted in bi-sql-examples/, or would the
    cross-vendor comparison be better placed elsewhere?
  • Is a runnable setup.sql acceptable alongside the Tableau folder's illustrative one, or
    should it be illustrative for consistency?
  • The model is a Dunder Mifflin-style demo schema (DM_* tables). The naming is
    recognisable fiction rather than anything real, and no data ships. Say the word if
    neutral naming is preferred and I will rename before submitting.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions