Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text-to-SQL Explorer

Python Streamlit Turso OpenRouter PyGWalker

Ask questions about your data in plain English — get real SQL, real results, and an AI-generated summary, all running against a live database. Built as a portfolio project to demonstrate SQL fluency, LLM integration, and safe database interaction patterns.

→ View Live Demo

What it does

  1. You type a question in plain English (e.g. "Which suburb had the highest CAGR?")
  2. The app reads the live database schema automatically (no hardcoded table definitions)
  3. An LLM (Nvidia Nemotron via OpenRouter) generates a SQL query from your question + the real schema
  4. The query is checked against a safety filter (blocks anything that isn't a pure SELECT)
  5. The query runs against a live Turso (libSQL/SQLite) database
  6. Results are shown as a table, summarized in plain English, and made explorable via an interactive drag-and-drop chart builder (PyGWalker)

Why these tools

  • Turso — serverless SQLite (libSQL), chosen to demonstrate range beyond Postgres-based tools (Supabase, Neon) used elsewhere in this portfolio
  • OpenRouter + Nvidia Nemotron — free-tier LLM access, consistent with the rest of this portfolio's AI integrations
  • PyGWalker — turns raw query results into an interactive, Tableau-style visual explorer with zero extra code per chart
  • Dynamic schema detection — the app queries sqlite_master and PRAGMA table_info at runtime, so it adapts automatically to whatever tables exist — no code changes needed to point it at new data

Safety

  • Only SELECT statements are ever executed — the app blocks DROP, DELETE, UPDATE, INSERT, ALTER, TRUNCATE, CREATE, and REPLACE before running anything
  • Generated queries are always shown to the user before/alongside results, so nothing runs silently

Tech stack

Python · Streamlit · Turso (libSQL) · OpenRouter API · PyGWalker · pandas

Setup

pip install -r requirements.txt

Create a .env file:

TURSO_DATABASE_URL=libsql://your-database-url.turso.io
TURSO_AUTH_TOKEN=your_token_here
OPENROUTER_API_KEY=your_openrouter_key_here

Run:

python -m streamlit run app.py

Example questions

  • Which suburb had the highest CAGR?
  • Compare Mickleham and Kalkallo prices over time
  • What's the average median price across all suburbs in 2026?

Author

Khoshaba Odeesho — github.com/Assyrian91 · LinkedIn

About

Ask questions about your data in plain English — LLM generates SQL, runs it live, and explains the results. Built with Streamlit, Turso (SQLite), and OpenRouter.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages