All work

19AI · Text-to-SQL · Analytics

Indaga

Ask-your-database analytics (text-to-SQL)

Managers ask the sales database a question in plain Portuguese and get a chart, a table and the SQL behind it, which can never change a single row.

Concept project · fictional brand and sample dataApp in Portuguese

35
automated tests passing
15/15
unsafe SQL statements blocked by the guard
3 s
execution budget per query, on a read-only connection
43%
execution accuracy on 30 test questions with a small local model

The brief

Managers have questions ("which stores grew most this quarter?", "is Pix overtaking credit cards?") and the answers sit in a database they can't query. Analysts become a queue, and generic chat-with-your-data tools either invent columns or are one prompt away from running something dangerous.

What I built

  • Question to SQL to table and an automatically chosen chart: line for time series, bars for rankings, donut for shares, a KPI for single values
  • SQL streamed as the local model writes it, with a plain-language explanation generated from the parsed query
  • SQL editor to adjust the query and rerun it through the same guard, without calling the model
  • One automatic repair attempt when a query fails with a fixable error; unsafe SQL is reported, never repaired
  • Saved questions on a dashboard that reruns the stored SQL directly, with product photos in the rankings
  • Evaluation page with execution accuracy on 30 hand-written questions and an attack suite of unsafe statements

The decision that mattered

The model's SQL is untrusted input

Whatever the model writes is parsed with sqlglot and checked before it runs: one statement only, SELECT and CTEs only, no write or schema commands anywhere in the tree, allow-listed tables, a capped LIMIT, then a read-only connection with a 3-second budget. The explanation is built from the parsed query, so it always describes the SQL that actually ran, not what the model says it did.

Screens

Question to SQL to a ranking with product photos
Edited SQL blocked by the guard
Dashboard of saved questions
Dashboard: product rankings
Evaluation: accuracy and the attack suite
Start screen with example questions
Data dictionary

Have a project in mind?

Send the brief through Workana. The reply comes with questions and a written scope before any quote, so the price reflects the actual work.

Hire me on Workana

What helps in a brief: what the finished thing must do, what already exists (site, store, server, accounts), your deadline and budget range, and two or three references you like.