feat(showcase-ecommerce): add 312 query entities for text-to-sql / anchor demo#198
Conversation
…chor demo Adds a corpus of urn:li:query MCPs to back the anchor-generation pipeline discussed in the talk-to-data demo work that datahub-project#195 set up the context docs for. Until now the showcase-ecommerce datapack had no query entities, so the anchor pipeline had no SQL to fingerprint and rank. What's added: - 04-queries.json — 1,246 MCPs spanning 312 urn:li:query entities: * 160 "cluster" queries across 50 distinct analyst intents (3–5 variants per intent: raw vs. analytics.order_details mart, CTE vs. subquery, alternate join paths, a few intentional anti-shapes) * 152 "noise" queries — one-off analyst drill-downs against specific customer/order/product/promotion IDs, date-window investigations, DQ checks, schema exploration, abandoned half-finished queries * Each query carries queryProperties, querySubjects (auto-detected dataset URNs), dataPlatformInstance (snowflake/b2fd91), and subTypes * created/lastModified timestamps spread across the data window so the corpus looks like a real activity history * authors mapped to the 11 corpuser entities already in 02-data.json (Sarah Chen, Andrea Garcia, David Kim, Ben Porter, Julia Novak, James Wilson, Karen Okonkwo, Ian Chen) - queries/ — readable source SQL alongside the build artifact: * One directory per intent with a 00-intent.yaml (question, canonical definition, variant axes, data caveats) plus the .sql files * noise/ subdirectory with the 152 long-tail queries * intent-matrix.yaml — top-level index across all 50 intents * README.md — contributor guide including data-realities gotchas (e.g. orders.order_status is NUMBER 0..4 not strings, mailshot is 0/1 not Y/N, customers.country_id isn't a real FK) - index.json — adds 04-queries.json to the file list The corpus was authored against the real ORDER_ENTRY_DB on snowflake (every query was executed against the warehouse during authoring) and surfaces a few demo-grade data anomalies on the way: - 4028/5027 promoted orders fall outside their promo's date window - 1250 In-Store Pickup orders carry a delivery_address_id - 3 warehouses show NEGATIVE avg dispatch lead time - Some promotions have negative discount rates (unit_price > list_price) - Order 9866 header_total = $210 but its line items sum to $1000 Verified via `datahub datapack load --dry-run` — all MCPs schema-compatible. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@alexsku is attempting to deploy a commit to the Acryl Data Team on Vercel. A member of the Team first needs to authorize it. |
|
@shirshanka — flagging for your review since you were driving the talk-to-data / context-docs work in #195 that this builds on. Happy to make changes. |
Test-load finding —
|
Summary
Adds
04-queries.jsonto the showcase-ecommerce datapack: 312urn:li:queryentities (1,246 MCPs total) plus the readable.sqlsource files they were built from. Until now the datapack had zero query entities, so the anchor-generation pipeline behind the text-to-SQL demo had no SQL to fingerprint and rank. This fills that gap.Follows on from #195 (which added the context docs / talk-to-data scenarios for the same demo).
What's in here
04-queries.json— 312 query entities, each withqueryProperties(SQL text + audit stamps),querySubjects(auto-detected fromorder_entry_db.*references),dataPlatformInstance(snowflake /b2fd91), andsubTypes. Authors mapped to the 11 existing corpuser entities in02-data.json.createdtimestamps spread across the data window so the corpus looks like real activity history.queries/— readable source SQL alongside the build artifact:00-intent.yaml(question, canonical definition, variant axes, data caveats) + 3–5.sqlvariants each (160 files)noise/— 152 long-tail one-off queries (per-customer/order/product/promotion drill-downs, date-window investigations, DQ checks, schema exploration, abandoned half-finished queries)intent-matrix.yaml— top-level index across all 50 intentsREADME.md— contributor guide, including data-realities gotchas (e.g.orders.order_statusisNUMBER 0..4not strings,mailshotis0/1notY/N,customers.country_idisn't a real FK)index.json— one-line addition that lists04-queries.jsonCluster vs. noise
The 160 cluster queries are organised into 50 intents (one per directory) — each intent has 3–5 variants that vary on join path (raw tables vs.
analytics.order_detailsmart), filter idiom, CTE vs. subquery, persona writing style, and occasionally an intentional "wrong-but-equivalent" shape. These should collapse to a single anchor per intent.The 152 noise queries are bespoke one-offs that should not cluster — they give the pipeline discrimination work and replicate real analyst-history distribution.
Demo-grade anomalies the corpus surfaces
A few real data inconsistencies that the queries pull into focus and that should make great demo moments:
orders_outside_promo_window)delivery_address_idthey shouldn't (pickup_orders_missing_delivery_addr, per the Order Count Discrepancy runbook)dispatch_datepredatesorder_date(avg_dispatch_lead_by_warehouse)unit_price > list_pricein the data (discount_rate_by_promo)order_total = \$210but its line items sum to $1,000 (gap surfaced by anorder_9866_header_vs_linesspot check)Test plan
datahub datapack load --dry-runagainst the local bundle — all 4 files parse, all MCPs schema-compatible (84 entity types / 726 aspects matched against current server schema)ORDER_ENTRY_DBon Snowflake during authoring; sampled noise queries also validated🤖 Generated with Claude Code