Chion SQL Query Generator — Try It on Your Postgres in 60 Seconds
Paste a read-only Postgres connection string, ask a question in plain English, and get a verified SELECT back in under a minute. Schema-profiled, LIMIT-enforced, capped at 1,000 rows. The SQL is shown under every chart. Each verified query joins your AI SQL workforce as an exportable skill.
Chion is an AI SQL workforce that turns plain English into verified PostgreSQL. Schema-aware, read-only, and auditable under every chart.
Problem. Analysts spend hours writing SQL by hand. PMs wait days for the data team. What Chion does. Paste a read-only PostgreSQL connection, ask in plain English, get a verified SQL query and an interactive chart in under a minute.
SELECT c.company_name, SUM(o.total_amount) AS revenue
FROM customers c JOIN orders o ON o.customer_id = c.customer_id
WHERE o.order_date >= DATE_TRUNC('quarter', CURRENT_DATE - INTERVAL '3 months')
GROUP BY c.company_name ORDER BY revenue DESC LIMIT 10;
Step 3 · Interactive chart
What is a SQL query generator?
A tool that converts plain-English questions into working SQL.
A SQL query generator is a tool that converts a plain-English question into a working SQL statement. An AI SQL query generator like Chion also reads your database schema first, picks the right tables and joins, and validates the output before running it. You get a SELECT statement you can execute or paste into any PostgreSQL client. No syntax knowledge required.
A real question, the generated SQL, and the verified output.
Question: "Who are our top 10 customers by revenue last quarter?"
SELECT
c.customer_id,
c.company_name,
SUM(o.total_amount) AS revenue
FROM customers c
JOIN orders o ON o.customer_id = c.customer_id
WHERE o.order_date >= DATE_TRUNC('quarter', CURRENT_DATE - INTERVAL '3 months')
AND o.order_date < DATE_TRUNC('quarter', CURRENT_DATE)
GROUP BY c.customer_id, c.company_name
ORDER BY revenue DESC
LIMIT 10;
Generated by Chion's 13-step pipeline. Read-only SELECT, LIMIT enforced, schema-validated.
How to generate a SQL query
From question to verified PostgreSQL, handled by a 13-step pipeline.
Type your question, Chion profiles your schema, builds a SQL contract, generates SQL inside that contract, validates it through L1 (read-only) and L2 (runtime lint), runs it read-only with LIMIT enforced, and renders the chart. Every step is auditable.
Each question routes to a different SQL shape before the model writes anything.
Ask "top 10 customers by revenue" and you get TopK ranking, which picks a different SQL shape than "compare revenue by region over time," which routes to comparison. The strategy determines the query structure before the model writes anything.
Explore the pipeline
Hover or tap any node to see how it works
7
Strategies
Schema profiling
We read your database before writing a single query.
Before the LLM sees anything, Chion runs a profiling pass against your database. Every table, every column, every data type, every cardinality, cataloged. Value samples are collected so the system knows what "Acme Corp" or "Q3 2024" actually looks like in your data.
Each column gets classified as temporal, quantitative, categorical, or identifier. This classification drives which aggregations are valid, which columns get grouped, and which columns get filtered. Entity resolution uses pgvector embeddings to match your words to actual column values.
Blocks anything that isn't a SELECT. INSERT, UPDATE, DELETE, DROP, ALTER are rejected at the contract level, in code, not in the LLM.
L2: Runtime lint (mode-based validation)
SELECT * is blocked. LIMIT is enforced. JOIN conditions are validated against the schema profile. Columns must be explicit.
Row budget truncation
Row budget truncation enforced at adapter level (≤1,000 rows / 12,000 cells). If results are truncated, the chart discloses it.
Featured SQL query examples
Three plain-English questions and the verified PostgreSQL Chion generates.
A ranking query, a multi-CTE ratio, and a window-function running total: three of the most common patterns Chion generates.
"Top 10 customers by revenue last quarter"
JOIN + GROUP BY + LIMIT
SELECT
c.customer_id,
c.company_name,
SUM(o.total_amount) AS revenue
FROM customers c
JOIN orders o ON o.customer_id = c.customer_id
WHERE o.order_date >= DATE_TRUNC('quarter', CURRENT_DATE - INTERVAL '3 months')
AND o.order_date < DATE_TRUNC('quarter', CURRENT_DATE)
GROUP BY c.customer_id, c.company_name
ORDER BY revenue DESC
LIMIT 10;
"Churn rate month over month"
CTE + ratio
WITH monthly AS (
SELECT
DATE_TRUNC('month', canceled_at) AS month,
COUNT(*) AS churned
FROM subscriptions
WHERE canceled_at IS NOT NULL
GROUP BY 1
),
active AS (
SELECT
DATE_TRUNC('month', period_start) AS month,
COUNT(DISTINCT user_id) AS active
FROM subscriptions
GROUP BY 1
)
SELECT
m.month,
m.churned,
a.active,
ROUND(m.churned::numeric / NULLIF(a.active, 0) * 100, 1) AS churn_rate_pct
FROM monthly m
JOIN active a ON a.month = m.month
ORDER BY m.month;
"Running total of revenue by week"
CTE + SUM OVER
WITH weekly AS (
SELECT DATE_TRUNC('week', order_date) AS week, SUM(amount) AS revenue
FROM orders GROUP BY 1
)
SELECT
week,
revenue,
SUM(revenue) OVER (ORDER BY week) AS running_total
FROM weekly
ORDER BY week;
Why a SQL query generator becomes a verified SQL agent inside Chion
A generator gives you a query. Chion gives you a verified SQL agent skill.
A standalone SQL query generator gives you a query: one off, ad-hoc, regenerated next time you ask. Chion’s pipeline gives you a verified SQL agent skill: every verified query auto-promotes into your team’s SQL skill library, scoped to the persona that owns the data. Finance personas inherit revenue queries; ops personas inherit logistics queries. The library compounds with every question your team asks.
Chion vs other text-to-SQL tools
SQL agent vs text-to-SQL: routing to verified queries, not regenerating every turn.
Feature
Chion
AskYourDatabase
Vanna
Julius
Routes to verified SQL agent (vs. generates fresh SQL each turn)
Auto-generated SQL skill library (vs. none; every query fresh-generated)
Portable AI agent file: CHION.md → Claude Code, Codex, Cursor (vs. locked to vendor UI)
Read-only SELECT enforced in code (not LLM instruction)
SQL visible under every chart
AES-256-GCM credential vault
Schema profiling before generation
Auto-repair loop on contract violation
Row budget enforced (1,000 rows / 12,000 cells)
Interactive D3 charts auto-selected by column type
Grounded narrative per chart
Per-team pricing (not per seat)
Self-host
Starting price
$29/mo
$19/mo
Free OSS / $200 cloud
$20/mo
7-day trial, no credit card
Competitor values verified from public product pages at time of writing. A verified SQL agent routes to queries your team already verified; text-to-SQL tools regenerate fresh SQL every turn. Correct a cell by opening a PR against src/data/comparisons.ts.