All work

Case study 02 / Data & ML · Agents

Text-to-SQL → Sheet Chat

Business teams ask sales questions in plain language and get an answer in about 10 seconds instead of waiting 1–2 days for a manual report.

Role
AI Engineer: design, backend, evaluation
Timeline
EVA Group · 2025 – present
Stack
Oracle Autonomous DB · FastAPI · LangGraph · DuckDB

01Problem

Every new question about sales data became a request to the data team, and a manual report took 1–2 days. Decision-makers either waited or decided without the numbers, and analysts spent their time on one-off SQL.

02Solution & architecture

  • Text-to-SQL: a question is mapped to the right schema context across 10 Oracle Autonomous DB tables, turned into SQL by an LLM, validated before it runs, and returned as a table with a plain-language explanation.
  • Evaluation: a set of 100 real business questions with expected answers. The system writes correct SQL for 90% of them, and every change is measured against the same set.
  • Sheet Chat: the same idea extended to any spreadsheet. It is a stateful LangGraph agent on DuckDB that plans the analysis, queries, draws charts and runs data-quality checks before answering.
Text-to-SQL and Sheet Chat architectureTop: a business question is matched to schema context from 10 tables, an LLM generates SQL, the SQL is validated and run on Oracle Autonomous Database, and the answer returns with an explanation. Bottom: an uploaded Excel or CSV file goes to a LangGraph planner that keeps state and routes to SQL on DuckDB, chart generation or data-quality checks, then to a natural-language explanation.TEXT-TO-SQL · ORACLE AUTONOMOUS DBSHEET CHAT · STATEFUL LANGGRAPH AGENTBusiness questionplain languageSchema context10 tablesSQL generationLLMValidate & runOracle ADBAnswertable + explanationExcel / CSVuser uploadPlannerLangGraph stateSQL · DuckDBChartsData-quality checksExplanationplain-language summary
One pattern, two surfaces: governed SQL over the warehouse, and an agent over any spreadsheet.

03Demo

04Results

  • ~10s

    per answer, down from 1–2 days of manual reporting

  • 90%

    correct SQL on a 100-question business eval set

  • 10tables

    of Oracle Autonomous DB queryable in plain language

05What I'd improve next

  • The last 10%: group the failing eval questions by cause (ambiguous wording, missing join, business-rule gaps) and fix each group with schema notes or few-shot examples.
  • Grow the eval set: log real user questions and promote the hard ones into the evaluation set, so it keeps up with how people actually ask.
  • Shared core: run the Oracle Text-to-SQL path through the same LangGraph planner as Sheet Chat, so both get charts and data-quality checks.

Enterprise project. The demo is a recording of the internal system, shared with George's approval; confidential details beyond what it shows are not published.