An interactive text-to-SQL system that translates plain-English analytics questions into executable SQL, validates safety, and measures quality with a rigorous evaluation harness.
Ask Your DB is built around a practical product question: can a text-to-SQL agent be accurate enough for real analytics workflows while staying fast and cost-efficient? Instead of optimizing for demo output, the project emphasizes executability, safety, and measurable quality across both known and unseen schemas.
The primary database is Chinook, a digital music store schema in SQLite with 11 related tables including Artist, Album, Track, Customer, Invoice, and InvoiceLine. This gives the agent realistic join paths for customer behavior, revenue, and catalog analytics. To test generalization beyond a familiar benchmark, the project also generates a second synthetic GitLab analytics schema with 7 tables and a larger templated question set.
In practice, the agent starts by reading schema metadata and sample rows from the active database. That context is injected into the prompt so SQL generation is grounded in actual table and column names rather than guessed structure.
One representative flow from the CLI looks like this:
Question: Which 5 customers spent the most in total?
Generated SQL:
SELECT
c.CustomerId,
c.FirstName || ' ' || c.LastName AS CustomerName,
ROUND(SUM(i.Total), 2) AS TotalSpent
FROM Customer c
JOIN Invoice i ON i.CustomerId = c.CustomerId
GROUP BY c.CustomerId, c.FirstName, c.LastName
ORDER BY TotalSpent DESC
LIMIT 5;
The agent executes this SQL directly and returns the top rows in the terminal, for example customer name and lifetime spend. If execution fails due to a dialect mismatch or naming issue, the error is fed back once and the query is auto-repaired before returning a final answer.
This project focuses on the gap between demo-grade and production-minded AI analytics. The value is not only that it produces SQL, but that it reports whether results are truly correct, stays within practical latency and cost ranges, and fails safely when a query is unsafe.
Role: Solo builder focused on agent architecture, evaluation design, reliability hardening, and cost-performance tradeoffs.
Tech Stack: Python, SQLite, Fireworks AI, OpenAI-compatible SDK, CLI tooling, JSON-based eval pipelines.
Category: Text-to-SQL, agentic analytics, LLM evaluation, trustworthy AI systems.
Positioning: Think "terminal-native BI copilot," designed for measurability and safe execution rather than prompt demos.