# Let analysts ask the data and check the SQL

Client delivery. Updated Nov 2026 by [Mangesh Kashid](https://eemky.xyz/index.md).

At Ellicium Solutions, I built tools that let analysts ask questions in plain language, inspect the generated SQL, and draft reports from query results.

Figure: An analyst question leads to a Generated SQL block labeled tables and joins. Query results feed charts and a draft report for analyst review.

- Role: Data Scientist
- Duration: 3-week proof of concept; 7-month production engagement

## Reporting and query results

- 70%+: Text-to-SQL query accuracy
- 10 to 30: SQL tables covered
- 20 to 40 minutes: Per report, down from 2 to 3 days

I reported these figures for this engagement. Query accuracy covers schemas of 10 to 30 tables. Time per report compares manual assembly with automated drafting.

## Start with one analyst question

The analysts knew what they wanted to find out, but getting an answer meant asking a data engineer to write the SQL. I used the proof of concept to test a narrower idea: let an analyst describe what they need in plain language and have the application generate the query.

Reporting had a different bottleneck. Once the results were available, analysts still had to assemble each report by hand. I started with access to the data; getting the results and turning them into a report were separate jobs.

Figure: Two lanes end in SQL. The original workflow sends an analyst question to a data engineer. The proof of concept sends a plain language question to query generation.

## Rebuild the prototype in Flask

I built the proof of concept in Streamlit, then moved to Flask for production and rebuilt both the backend and frontend. I also built the interface where analysts could read the results and check the SQL behind them.

## Retrieve schema context before writing SQL

I built the Text-to-SQL system to look up schema context before asking the model to write a query. It retrieved the relevant tables and joins rather than putting the entire schema into the prompt. The analyst could ask about the data without having to name the tables or spell out how they related.

Figure: A slider shows 10 to 30 table slots. Three example tables and their joins stay highlighted as context for SQL generation.

## Keep the generated SQL visible

I showed the generated SQL alongside the result. A result can look plausible even if the query asked something different from what the analyst meant. Keeping the SQL visible meant the analyst had something concrete to inspect, such as which tables the query used or how it joined them.

## Draft the report and leave review to the analyst

I used a language model to draft text from the query results and added interactive charts. The analyst could edit and approve the draft, so the model took on some of the assembly without deciding what was ready to share.

## Compare time per report

I automated report assembly: analysts started a draft and charts from the query results instead of copying the data into a blank report.

Figure: The reported time per report is 2 to 3 days with manual assembly and 20 to 40 minutes with automated drafting.

## Connect the work without hiding the review

I worked across querying, prediction, and reporting. The connection I can show is how the query results gave the report generator material to draft from. An analyst could check how the results were produced and then decide how to present them.

Figure: Querying, prediction, and reporting are shown as three workstreams, with query results feeding reporting.

- [See my work history](https://www.linkedin.com/in/mangeshkashid/details/experience/)

Page: https://eemky.xyz/analytics-reporting
