A system that lets you connect to a database (Postgres, MySQL, or SQLite) and ask questions in plain English instead of writing SQL by hand.
- Connect — provide DB credentials via API (no hardcoding), and the system introspects your schema automatically.
- Index — table structures, columns, and relationships get embedded and stored in Pinecone, scoped to your connection so different databases never mix.
- Ask — a natural language question retrieves the relevant schema context, builds a grounded prompt, and an LLM (Groq) generates the SQL.
- Validate — every query is checked before execution: SELECT-only enforcement, dialect-aware parsing, and a dry-run EXPLAIN against the real database to catch bad references before anything runs.
- Answer — results come back as structured data, or, for schema questions like "summarize the database," a direct plain-English answer with no SQL involved at all.
- Backend: FastAPI
- DB abstraction: SQLAlchemy (Postgres / MySQL / SQLite)
- Embeddings: sentence-transformers (
all-mpnet-base-v2, local, free) - Vector store: Pinecone (namespace-isolated per connection)
- LLM: Groq
- SQL validation: sqlglot + EXPLAIN dry-runs
A frontend, deployment setup, and further hardening are still to come. Check back in a few months for a more complete version.