DataView-Lite
Explore a SQLite database in plain language: a local model writes read-only SQL, a validator checks it, and a second model phrases the answer. Built for a two-hour technical test.
TL;DR
- 8 demo databases
- 3 SQL safety layers
My partBuilt the whole stack solo: the Next.js single-page app, the API routes and a typed library layer for introspection, label humanisation and the assistant.
- ROLE
- Solo
- CONTEXT
- Technical test
- STATUS
- Done
- RESULT
- A working single-page SQLite explorer with a natural-language assistant that runs entirely locally, or fully mocked with no model, shipped with eight demo databases and a one-command start.
- LAST UPDATED
- 26 Sep 2026
1
What I built
Solo
- Built the whole stack solo: the Next.js single-page app, the API routes and a typed library layer for introspection, label humanisation and the assistant.
- Designed the natural-language-to-SQL pipeline — Qwen generates SQL as strict JSON, Llama phrases the answer from the result, capped at two model calls per question, with a full mock fallback so it runs with no Ollama.
- Hardened the assistant with three independent locks: the database is opened read-only, a SQL guard, and a validator that allows only SELECT and WITH, blocks multiple statements and blacklists write keywords.
- Wrote generic label humanisation (prefix and abbreviation heuristics plus an extensible French dictionary, refined by a batched model call and cached per schema) so it works on an unknown database.
2
Key choices
- Read-only by construction
- The database is opened read-only and every query passes a guard and a validator (SELECT and WITH only, no multiple statements, a forbidden-keyword blacklist), so a bad model output cannot mutate data.
- Local models with an automatic mock fallback
- The app probes Ollama and silently drops to a heuristic mock when it is unreachable, so a demo never breaks on a missing model.
- A single screen, no routing
- Sidebar, data and assistant on one page, chosen to cut complexity under the two-hour limit and keep non-technical users oriented.
3
Results
A working single-page SQLite explorer with a natural-language assistant that runs entirely locally, or fully mocked with no model, shipped with eight demo databases and a one-command start.
4
Limits
- SQL safety is regex and keyword based, not AST parsing (listed as future work).
- No persistence: databases and context live in memory, with no saved sessions or history.
- Only the Ollama client and the mock are implemented; the OpenAI and Anthropic settings are untested placeholders.
- Not responsive, no streamed answers, and never deployed to production.
Questions about this project? → Email me