All case studies / Case study 09 / 12
Ostral Distribution
Plain-language data analysis agent
Query the data warehouse without writing a line of SQL
In short
Managers ask their question in plain words; the agent finds the right tables, writes the SQL, fixes it if it fails, runs it read-only and answers with a figure, a chart and an explanation.
- Client
- Ostral Distribution
- Sector
- Retail and consumer goods
- Size
- 1,400 staff, 60 stores
- 30 sinstead of days to get a figure
- 140 tablesunderstood without the user knowing them
- Read-onlyno data can ever be changed
The context
At Ostral Distribution, every question from sales and finance went through the data team: a request, a queue, then a dashboard delivered one or two weeks later, often already out of date.
The challenge
- 01
The warehouse has 140 tables with technical names no one outside the data team knows.
- 02
A badly written SQL query gives a wrong number, delivered with confidence.
- 03
Users must only see the data they are entitled to.
- 04
No query may change or slow down the production database.
Our approach
The description of every table and column is indexed: for each question, the agent retrieves only the useful parts of the schema. It generates the query and runs it in an isolated, read-only sandbox with the user’s own rights. If the database returns an error, the agent reads it and rewrites the query. The result is explained in one sentence and comes with a chart.
The solution, step by step
- 01
A business question
“What were our top 3 selling categories in Q4, by region?”
- 02
The right schema, found
Among 140 tables, the agent finds the three that matter: sales, products, stores.
- 03
A query generated
The SQL is written and run read-only, with the user’s rights.
- 04
Fixed when needed
The database returns an error? The agent reads it, understands and rewrites the query.
- 05
An explained result
A table, a chart and one sentence to understand the figure.
Results
- 30 sfor a figure-based answer
- −60%ad-hoc requests to the data team
- 92%correct queries first time, 99% after self-correction
- 0write access to the database
What we deliver
- Documented schema index (tables, columns, business definitions)
- Text-to-SQL agent with a correction loop
- Isolated read-only execution, per-user rights
- Question interface with charts
- Query log for the data team
Technologies
- LangChain
- PostgreSQL
- BigQuery
- Claude / OpenAI API
- Python
- React
Timeline
6 to 10 weeks
Team
1 AI engineer, 1 data engineer
Illustrative cases: clients and figures are fictional, representative of the solutions we deliver.