Implementing Natural Language Analytics with Snowflake Cortex

Ved Prakash10 Dec 2025

Problem

Business users at GitLab raised a ticket for every dashboard. Building one took from a week to a month, and the user then had to check the numbers. Dashboards are also fixed: a new question sends the user back to the analyst. A text-to-SQL tool removes the wait, but a wrong answer costs more than a slow one. The first prototype confused terms such as "revenue".

Example from the article: a finance user asking for total revenue and getting 10 billion when the real figure is 1 billion, then using it in quarterly results.

Solution in brief

GitLab ran Snowflake Cortex Analyst, which generates SQL from a question using a YAML semantic model of the warehouse. The team raised accuracy by putting business logic into that model (metric formulas, synonyms, default filters, custom instructions) and by feeding analyst-approved queries back into it. Existing role-based access, clarifying questions and graceful errors handle risky requests.

Questions this case answers
  • How to let non-technical users query governed warehouse tables in natural language when ambiguous business terms produce wrong SQL and users lose trust after one bad number
  • How to improve the accuracy of a text-to-SQL system you cannot retrain by adding business context and verified queries
  • How to let business users get answers from warehouse data without waiting for an analyst?
  • How to make LLM-generated SQL accurate enough for business users to trust?

Tools and methods

  • Snowflake Cortex Analyst — turns a question into SQL inside Snowflake, shows the SQL, runs it under the user's role
  • Semantic model (YAML) — maps business terms to tables, joins, metrics, filters and synonyms
  • Verified queries — frequent questions approved by an analyst and fed back into the semantic model
  • Cortex Search — maps user wording ("iPhone 13") to stored values ("Apple iPhone 13")
  • Streamlit — the chat interface GitLab built for end users
Continue reading — it's free

Google or a one-time email code. No password.