Skip to content
SQL Analyst
Interactive demo, simulated data

Ask your database in plain English. Get safe, checked SQL.

SQL Analyst turns business questions into read-only SQL over Postgres, shows the query it ran, and explains the result. Watch it work end to end, then try it yourself.

Designed around
Next.js 16React 19TypeScriptFastAPILangGraphPostgreSQL 16pgvectorsqlglotRedis 8arqOpenTelemetryCaddyDocker ComposeMCPNext.js 16React 19TypeScriptFastAPILangGraphPostgreSQL 16pgvectorsqlglotRedis 8arqOpenTelemetryCaddyDocker ComposeMCP
How it works

From a question to an answer you can check

Each answer passes through the same eight steps. The trail of steps is shown under every answer.

Find the right tables

Hybrid search over table and column descriptions, sample values and verified examples picks the context for the question.

Ask when it is unclear

If a question can mean several things, the agent asks one short question instead of guessing.

Write and check the SQL

Three candidate queries are written in parallel, and a parser-based guard allows only one read-only SELECT.

Run it and explain

Queries run read-only with a timeout and row cap. The answer comes back as a table, a chart and a short summary.

What it does

Built for people who need to trust the numbers

transparent

Every answer shows its SQL

The exact query that produced the numbers is one click away, with every candidate and repair in the inspector.

safety

Three layers of safety

A SQL guard, a read-only database role and row-level security. A destructive query never reaches the database.

access

Row-level security per person

A regional manager sees only their state. Postgres enforces it from a signed session value, whatever the SQL says.

reliability

Repairs its own mistakes

When a query fails, the exact database error goes back to the model for a bounded number of repair rounds.

feedback

Learns from approved answers

A thumbs-up and a proposal send a query to an admin. Approved queries become examples for similar questions.

catalog

A catalog people can edit

Table and column descriptions, sample values and metric definitions in YAML, edited by admins and used in every prompt.

Under the hood

How the full system is designed

The full product runs as a set of services behind one origin. The public demo on this site runs on simulated data in your browser.

System architectureA question goes from the browser through Caddy to the FastAPI API, which runs a LangGraph agent: retrieve, clarify, generate three candidates, guard, execute, repair, select and compose. The agent reads the Olist data in Postgres as a read-only role with row-level security, and calls a metered LLM provider. Supporting services: an app Postgres with pgvector, Redis, an arq worker for catalog sync, OpenTelemetry traces in Jaeger, and an MCP server.BrowserNext.js 16, React 19CaddyTLS, one originFastAPIauth, limits, SSELangGraph agent1retrieve2clarify3generate x34guard5execute6repair7select8composeOlist in Postgresread-only role, row-level securityApp Postgrespgvector, runsRedisrows, limits, jobsarq workercatalog syncTracesOTel, JaegerLLM providermetered, cappedMCP serverlist, describe, ask
How the full system is designed. Solid blue: the path a question takes. Dashed: supporting services. The public demo runs none of these services: it plays scripted answers, built from real query results, in your browser.

Three candidates, then a vote

Candidates that return the same result agree; ties go to fewer repairs, then shorter SQL. One bad generation does not decide the answer.

The guard re-renders SQL

Queries are parsed with sqlglot and re-rendered from the checked syntax tree, so what runs is exactly what was checked.

Streams survive a dropped connection

The run continues on the server; the browser reconnects by polling the run, so a flaky network does not lose an answer.

Definitions live in one place

Revenue, late delivery and the other metrics are defined once in a semantic layer, so every query uses the same meaning.

FAQ

Questions people ask

Is this real?

The product is real: a FastAPI and LangGraph backend, Postgres with row-level security and a Next.js frontend, with tests and a Docker setup. This public page is a static demo. It plays scripted answers in your browser; the result numbers come from running the same queries on the public Olist dataset. Timings, tokens and cost shown in the demo are simulated.

Can I use it?

You can explore the demo workspace: ask any of the suggested questions, open the inspector, switch persona to see row-level security, and try feedback and approvals. Sign-ups are closed and nothing you do is saved.

What does it cost to run?

This demo costs nothing to run: it is static files with no backend, no database and no model calls. The full system runs on one server with Docker Compose and pays per model call, with a daily budget cap built in.

Has it been benchmarked?

Not yet. The evaluation harness (BIRD Mini-Dev, a golden question set and a safety red team) is built, but results with a real model have not been published. The Method page explains how it is measured.

Where is the code?

The code is in a private repository for now. Ask through the About me page if you would like to see it.

Who built it?

Tiju Lukose, as a portfolio project. The About me page has more about my work.

Built by Tiju Lukose

SQL Analyst is a portfolio project. More about my work, and how to reach me, is on my site.