1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
51 small wins to finish your pathNext question →
Design a natural-language analytics assistant (text-to-SQL) over a company data warehouse.
30-second answerSay your answer out loud first, then reveal.

Key challenges
- Schema scale: warehouses have thousands of tables. Retrieve relevant tables via embeddings and metadata; maintain a curated "gold" subset for common questions.
- Business semantics: "active user", "revenue", "churn" have company-specific definitions. Encode them in a semantic layer (dbt metrics, LookML-style), or have the LLM generate metric queries instead of raw SQL.
- Correctness: queries can be syntactically valid but semantically wrong (wrong join, double counting). Mitigations: verified example queries (few-shot retrieval), showing the SQL and assumptions, result sanity checks.
- Security: read-only roles, row and column-level security per user, PII column masking, query cost limits.
- Evaluation: execution accuracy (does the result match the gold query's result?) on 100–300 real questions.
UX: show the interpretation ("I interpreted 'last quarter' as Jul–Sep 2026, revenue = net revenue") so users can catch mistakes.
Related
Little by little, you're building something great.