How Wren AI turns a question into an answer

Ask in plain language. Wren retrieves the business context that matters, writes the SQL, validates it, and runs it against your own database — the data stays where it lives.

Watch a plain-language question become a validated answer.
1

Ask a question

surface · Wren UI / your agent (MCP, Claude Code, Cursor)

A user asks in natural language. No SQL, no need to know table names — just the business question and its context (who's asking, which connected data source).

“Top products by revenue this quarter?” Data source: connected

Why natural language is enough

  • Questions resolve against your semantic model (MDL), so “revenue” means what your business defines it to mean — not a raw column guess.
  • The same question works from the Wren UI or from any agent that speaks to Wren over MCP.
2

Retrieve the right context

Wren AI Service · vector search + MDL + knowledge

Instead of dumping the whole schema at the model, Wren AI Service pulls only the fragments that matter: relevant tables and columns, past confirmed queries, and the business rules tied to them.

MDL scoping Knowledge filtering

Handling very large schemas (hundreds–thousands of tables)

  • Wren never sends the entire schema. It uses semantic retrieval + schema linking to fetch only relevant fragments.
  • When an answer spans several tables, MDL relationships and knowledge rules help complete the joins.
  • Prompts stay inside the model's context window regardless of overall schema size.
3

Generate the SQL

Wren AI Service → LLM · grounded prompt, not a raw one

The retrieved context guides the LLM to produce modeled SQL — grounded in your definitions instead of a hopeful guess.

-- modeled SQL, written against your semantic layer
SELECT product_name, SUM(net_revenue) AS revenue
FROM orders
WHERE quarter = current_quarter()
GROUP BY product_name ORDER BY revenue DESC LIMIT 10;

What actually leaves your environment for the model

Sent to the LLM context only
  • The user's question
  • Schema metadata (tables, columns)
  • MDL definitions
  • Knowledge rules & semantic context
  • Some sampled values (profiling)
  • Aggregated results, to summarise the answer
Stays in your environment never shipped
  • A bulk copy of your database
  • Raw row-level records at large
  • Query execution — runs on your source
Privacy: Wren applies privacy controls to every model call and does not train public foundation models on your data — it's SOC 2 Type II certified. For full data residency, Enterprise Plus with BYO LLM keeps AI processing inside your own environment.
4

Validate & execute

Wren AI Core (Wren Engine) · dry-plan → dialect → run

Wren AI Core dry-plans and validates the query, transpiles modeled SQL into your database's exact dialect, enforces access control, then executes it against your connected source.

Dry-plan validation Dialect transpile Access control Runs on your DB

Correctness, not confidently-wrong

  • Invalid SQL is caught before it runs and returned as a structured error with hints for a self-correcting retry.
  • Transpilation targets 22+ sources (Snowflake, BigQuery, Redshift, Postgres, MySQL…) from one modeled query.
  • Execution happens where your data already lives — Wren generates and sends SQL, it doesn't relocate your warehouse.
5

See the answer

Wren UI · result + chart + follow-ups

Wren UI shows the result preview, a chart, and smart follow-up questions — and you can save or share it as a GenBI view.

Answer complete · 2.4s
Top products by revenue — this quarter
Revenue · Jan 1–Mar 31, 2026 · USD
ChartData
Total revenue$4.63M
vs. last quarter+18.6%
Top product share30.7%
This quarterLast quarter
$0$0.5M$1.0M$1.5M
Atlas leads at $1.42M and grew 31% quarter over quarter, contributing the largest share of the portfolio increase.
↗ Break down by region↗ Show monthly trend↗ Why did Atlas lead?

And it gets smarter

  • Confirmed question→SQL pairs are stored in memory and recalled on future questions.
  • Feedback and reviewed examples seed later retrieval, so repeated question shapes get faster and more accurate.