Skip to content

feat(showcase-ecommerce-mssql): add standalone SQL Server datapack - #239

Open
askumar27 wants to merge 3 commits into
mainfrom
feat/showcase-ecommerce-add-mssql
Open

askumar27 wants to merge 3 commits into
mainfrom
feat/showcase-ecommerce-add-mssql

Conversation

@askumar27

@askumar27 askumar27 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds a standalone datapack that mirrors the Databricks showcase-ecommerce datapack with Microsoft SQL Server as the warehouse platform.

datapacks/showcase-ecommerce-mssql/

Self-contained (01-definitions → 05-context + index.json), stacked on #200 like #209, #237 and #238. It can be loaded on its own or next to the other showcase packs.

How it was derived

Generated from showcase-ecommerce-databricks with the same platform transform as the Trino and MySQL packs:

Dimension SQL Server
Platform URN dataPlatform:mssql
Dataset names unchanged: order_entry_db.<schema>.<table> (database.schema.table, as the SQL Server source names them)
Containers Database / Schema, GUIDs from DataHub's DatabaseKey / SchemaKey, so they match what the SQL Server source emits
Column types string→nvarchar(255), double→float, timestamp→datetime2; int, bigint, date unchanged
Databricks-only metadata removed: Unity externalUrl, storage_location, table_id, table_type, delta.*, spark.*, view.* properties

SQL dialect

T-SQL is further from Databricks SQL than the earlier targets. It has no JOIN … USING (228 uses), no LIMIT (66), no GROUP BY ordinals, no CURRENT_DATE, ANY_VALUE or ||, and TIMESTAMP is a row-version type. So the queries were rebuilt structurally with sqlglot instead of edited textually:

  • USING joins become ON joins with qualified columns. Unqualified join columns resolve to the left table, as in Databricks.
  • LIMIT n → TOP n, GROUP BY 1, 2 → the grouped expressions, DATE_TRUNC → DATETRUNC (SQL Server 2022), CAST(… AS TIMESTAMP) → DATETIME2, || → +, MONTHS_BETWEEN → DATEDIFF(month, …), day names and numbers via FORMAT / DATEPART.
  • AVG over integers returns an integer in SQL Server (Databricks returns a double). Integer AVG inputs are cast to FLOAT in 15 queries, so averages such as "average days to dispatch" are not truncated.
  • Each query's author header comment is kept verbatim. The SQL body is reformatted.
  • 17 queries are hand-written: the 12 MEDIAN / PERCENTILE_CONT queries (SQL Server's PERCENTILE_CONT is window-only, so percentiles are computed with OVER (PARTITION BY …) and collapsed with MAX), 2 that aggregate over a subquery (not allowed in T-SQL), plus QUALIFY, a distinct STRING_AGG, and one noise query that relied on Databricks reading "condition" as a string.

Also fixed, as in #237 and #238:

  • The snowflake_freshness_check query family is renamed mssql_freshness_check.
  • View-lineage query URNs encode the SQL Server view.
  • Shared-layer containers keep their own platform property.
  • The knowledge documents point at SQL Server, including T-SQL versions of their SQL examples.

Validation

  • SQL: every query, the view definition and every SQL block in the documents compiled with SET SHOWPLAN_XML ON on a live SQL Server 2022, with tables built from the pack's own schemaMetadata. That binds every table and column without running the query. 311/312 queries valid. The one failure is q-noise-abandoned_logon_to_order_funnel, a deliberate noise query on a logon table that is in no pack (same in the Databricks pack). The percentile idiom was checked numerically (values 1–10: median 5.5, p90 9.1).
  • Ingestion: loaded with datahub datapack load --url file://…/index.json into a fresh local DataHub: zero failures. Read-back shows 14 datasets, 4 containers and 312 queries on mssql. On a brand-new instance the first load attempt can reach 02-shared before the structured-property definitions from 01-definitions are registered; loading again succeeds.
  • Structure: no Databricks, Unity, Delta or Spark leftovers; every SQL Server dataset and container URN referenced in the pack exists in it (only the noise query's logon table is missing).

Notes

  • The knowledge documents (urn:li:document:ecomm-*) and the shared layer (dbt, Looker, Power BI, Tableau, S3, Postgres) have the same URNs in every showcase pack. If two platform packs are loaded into one instance, the last one loaded owns them.
  • The documents' SQL examples inherit one issue from the source pack: they filter the integer order_status column with 'Cancelled' / 'On Hold'. It is left as in the other packs.

🤖 Generated with Claude Code

askumar27 added 3 commits June 2, 2026 17:11
Add a new `showcase-ecommerce-databricks` datapack that mirrors the existing
Snowflake showcase-ecommerce datapack with Databricks as the warehouse platform.

- 14 Databricks datasets (order_entry_db.order_entry + analytics schemas)
- Full governance parity: tags, glossary terms, ownership, domains, structured
  properties, editable descriptions, lineage, siblings, schema fields
- 312 queries translated from Snowflake SQL to Databricks SQL dialect
  (CAST syntax, DATEADD/DATEDIFF units, LISTAGG -> ARRAY_JOIN, TO_CHAR -> DATE_FORMAT)
- All cross-platform entities included (dbt, Looker, PowerBI, Tableau, Spark, etc.)
  with Snowflake order_entry_db references remapped to Databricks
- Can be loaded independently or alongside the Snowflake datapack (no URN conflicts)
…r ingestion

Add queryUsageFeatures aspect to all 312 query entities so semantic-anchor
ingestion can discover and group them. Without this aspect, queries default
to exec_count=0/users=[] and get filtered by the min_distinct_users threshold.

- Cluster queries (160, 50 intents): exec_count 15-45, 3-4 users each
  Users derived from SQL author comments + intent-group sharing
- Noise queries (152): exec_count 1-5, 1-2 users (correctly below threshold)
- Uses the 8 author personas from Alex's query corpus README
Mirror of the Databricks showcase-ecommerce datapack with Microsoft SQL
Server as the warehouse: mssql platform URNs, Database/Schema containers
keyed like the SQL Server source, SQL Server column types, Unity/Delta/
Spark-only properties removed, and all 312 queries rewritten to T-SQL
(compiled with SHOWPLAN on a live SQL Server 2022). T-SQL has no JOIN ...
USING, LIMIT, GROUP BY ordinals or aggregate percentiles, so queries were
rebuilt structurally; integer AVGs cast to FLOAT to keep Databricks
semantics.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant