Drop in a CSV and ask it questions in plain English — get an answer, the SQL it ran, and a results table. A talk-to-your-data BI analyst as one small service.
- Replaces: ad-hoc "can you pull this number?" requests to a data analyst
- Ship in: ~5 minutes
- Offline demo mode: built-in example questions run end-to-end with zero API keys
- Stack: Python / FastAPI + SQLite (read-only), no external DB
cp .env.example .env # offline demo needs no configuration
docker compose up
# open http://localhost:8000pip install -r requirements.txt
python app.py "revenue by region"
python app.py "who is the top rep"Replace data/sales.csv with any CSV (or set CSV_PATH). The
column types are inferred automatically. With an API key, you can ask anything;
offline, the built-in example questions still work against your columns if named
similarly.
Point at any OpenAI-compatible endpoint in .env (Ollama, LiteLLM, LocalAI,
vLLM, or a hosted gateway):
LLM_BASE_URL=http://localhost:11434/v1 # e.g. local Ollama
LLM_MODEL=llama3.1
LLM_API_KEY= # set for hosted gatewaysNow any question becomes SQL. Queries are read-only — only a single SELECT
is ever executed (see db.py).
db.py— loads the CSV into in-memory SQLite;run_sql()allows only single read-onlySELECTs.llm.py— turns a question into SQL via your OpenAI-compatible endpoint, with offline example-question fallback and a no-API answer narrator.app.py— FastAPI (POST /api/ask) + web UI + CLI.
Only a single SELECT statement runs; multiple statements, writes, and DDL are
rejected. Still, point this at a read-only replica or a copy for anything sensitive.
- Swap SQLite for your warehouse connection and graduate to Vanna or Wren AI for a full text-to-SQL layer.
Part of AI Workforce · Data department →