Status: in progress. Core pipeline, demo datasets and tests work; benchmark results and a hosted demo are next.
AskData is a web application for asking questions about a PostgreSQL database in plain language.
The app turns a question into a read-only SQL query, runs it against PostgreSQL, and returns:
- a direct answer
- a result table when it helps
- a chart when the result is clearly suited to one
- the SQL and table lineage behind the answer when you want to inspect it
AskData is built as a product, not just a text-to-SQL script. It includes a chat interface, schema view, local session history for the demo datasets, and a runtime PostgreSQL connection flow for testing the system on another database.
AskData currently supports:
- PostgreSQL only
- two included demo datasets:
pagilaretail_ops
- runtime PostgreSQL connection from the UI
- schema overview for the active target
- schema-aware retrieval before SQL generation
- planner-guided SQL generation
- SQL validation for read-only safety
- bounded repair and retry behavior
- answer formatting with:
- answer text
- table
- bar chart
- line chart
- local persisted session history for demo datasets
Current limits:
- no authentication
- no saved database connections
- no secret vaulting
- no non-PostgreSQL databases
- runtime PostgreSQL mode is ephemeral and does not use persisted session history
AskData has three main runtime pieces:
Next.jsfrontendFastAPIbackendPostgreSQL
The backend flow is:
- receive a question
- load the active schema context
- build a lightweight plan
- retrieve relevant tables and columns
- generate SQL
- validate the SQL against read-only rules
- execute the query
- format the answer for the UI
The backend uses a custom bounded pipeline rather than a generic agent framework.
Editable source:
Frontend:
Next.jsTypeScriptTailwind CSSRecharts
Backend:
FastAPIPydanticpsycopgsqlglotOpenAI
Local infrastructure:
PostgreSQLDocker Compose
AskData/
├─ backend/
├─ frontend/
├─ demo_data/
├─ assets/
├─ docker-compose.yml
└─ Makefile
Python 3.11+Node.js 20+npmDockerandDocker ComposeOPENAI_API_KEY
make docker-upPostgreSQL is exposed on localhost:55432.
AskData starts on pagila by default.
To switch demo datasets:
make load-dataset DATASET=retail_opsAvailable values:
pagilaretail_ops
This reloads the public schema and leaves the internal askdata_app schema intact.
Important:
- built-in demo switching is shared in local mode because it reloads one local demo database
- runtime PostgreSQL targets are per browser token and live only in backend memory in this version
Backend:
cp backend/.env.example backend/.envThen set your OpenAI key in backend/.env.
Frontend:
cp frontend/.env.example frontend/.env.localmake backend-install
make frontend-installmake backend-dev
make frontend-devOpen:
- frontend:
http://127.0.0.1:3000 - backend:
http://127.0.0.1:8000
When a demo dataset is active, AskData supports:
- suggested questions
- persisted local session history
- session rename
- rerun
- CSV export
You can connect a PostgreSQL database from the sidebar with:
- host
- port
- database
- user
- password
- ssl mode
- optional schema allowlist
In runtime PostgreSQL mode:
- AskData uses the connected database for schema view and query execution
- suggested demo questions are hidden
- session history is disabled
- the connection is temporary and disappears after backend restart
Run the main checks:
make verifyThat runs:
- backend tests
- frontend lint
- frontend build
Useful direct checks:
curl http://127.0.0.1:8000/health
curl http://127.0.0.1:8000/data-sources
curl http://127.0.0.1:8000/schema/overviewIf you switch demo datasets while the backend is already running, you can refresh the active schema cache with:
make reload-schema-cache


