Snowflake Cortex Analyst

Business leaders ask questions in plain words: "What was last quarter's revenue by region?" Analysts translate each question into SQL, and the queue of requests grows. Cortex Analyst converts natural language questions into SQL against your tables, guided by a semantic model that explains what the data means.

The Interpreter Comparison

A travel interpreter knows two languages and the local customs. Without a guide, a word like "revenue" might translate to the wrong column. Cortex Analyst acts as an interpreter between business language and SQL. A semantic model serves as the dictionary that says which column counts as revenue, which tables join, and which synonyms people use.

FROM QUESTION TO ANSWER
=======================

 "Revenue by region last quarter?"
            |
            v
 +----------------------------+      +--------------------------+
 |      CORTEX ANALYST        |<-----| SEMANTIC MODEL           |
 |  understands the question  |      | revenue = SUM(amount)    |
 |  writes the SQL            |      | region = stores.region   |
 +-------------+--------------+      +--------------------------+
               |
               v
 SELECT region, SUM(amount) FROM ... WHERE quarter = ... GROUP BY region
               |
               v
        Warehouse runs it, user sees a table or chart

Why a Semantic Model Matters

Large language models guess when tables use cryptic names like col_17 or amt_net. A semantic model removes the guessing. It describes business meaning once, and every question benefits.

WHAT A SEMANTIC MODEL DEFINES
=============================
Tables         which tables take part
Dimensions     ways to slice: region, product, month
Facts          raw numbers: order amount, quantity
Metrics        business formulas: revenue, average order value
Relationships  how tables join: orders.store_id = stores.store_id
Synonyms       other words people use: "sales" = revenue
Filters        common rules: "active customers"

Snowflake now builds semantic models as semantic views, which live in the database like other objects and follow the same role-based access. Older projects use a YAML file stored on a stage. Check current documentation for the creation method that fits your account.

What Analyst Returns

Analyst returns a SQL statement and a plain-language explanation of how it understood the question. The calling application runs the SQL on a warehouse and shows the result. The user sees the interpretation and can correct a misunderstanding.

QUESTION:  Which three regions had the highest revenue last quarter?

INTERPRETATION: Total revenue grouped by region for the previous quarter,
                top three by revenue.

GENERATED SQL:
SELECT region, SUM(amount) AS revenue
FROM orders o JOIN stores s ON o.store_id = s.store_id
WHERE o.order_date >= DATEADD('quarter', -1, DATE_TRUNC('quarter', CURRENT_DATE()))
  AND o.order_date <  DATE_TRUNC('quarter', CURRENT_DATE())
GROUP BY region
ORDER BY revenue DESC
LIMIT 3;

Access and Security

Users need the SNOWFLAKE.CORTEX_ANALYST_USER role, and the generated SQL runs with the caller's data permissions. Masking policies and row access policies apply as usual. A manager who cannot read salary columns receives no salary data through Analyst either.

GRANT DATABASE ROLE SNOWFLAKE.CORTEX_ANALYST_USER TO ROLE business_users;

Building a Good Semantic Model

  • Start with one subject area, such as sales, rather than the whole warehouse.
  • Write clear descriptions for every table and column in plain business words.
  • Add synonyms that real users type.
  • Define metrics explicitly so every question uses the same formula.
  • Add verified example questions with correct SQL, which guide the model on tricky cases.

Testing and Improving

IMPROVEMENT LOOP
================
1. Collect twenty real questions from business users
2. Run each question through Analyst
3. Compare the SQL and results with a trusted analyst's answers
4. Fix descriptions, synonyms, or metrics where answers differ
5. Add corrected questions as verified examples
6. Repeat after every major schema change

Limits to Know

Analyst works best on well-modeled, structured tables. Very vague questions may need a clarifying follow-up. Complex multi-step reasoning, or questions that combine tables with documents, fit Cortex Agents better. Snowflake steers new conversational builds toward Cortex Agents, which call Analyst underneath, while the Analyst API remains available for direct use.

A Practical Scenario

A regional sales director asks the same five questions every Monday and waits a day for the analyst's reply. The analyst builds a semantic model over the sales tables with metrics for revenue and order count. The director types questions into a small app and receives answers with the SQL shown beside them. The analyst now spends time on deeper analysis and checks the model when numbers look odd.

Key Points

  • Cortex Analyst turns plain questions into SQL.
  • A semantic model supplies the business meaning of tables, metrics, and joins.
  • Results include the SQL and an explanation of the interpretation.
  • Generated SQL runs under the caller's permissions and policies.
  • Verified example questions raise accuracy.
  • Agents extend Analyst to multi-step and mixed data questions.