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

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

  1. 01

    The warehouse has 140 tables with technical names no one outside the data team knows.

  2. 02

    A badly written SQL query gives a wrong number, delivered with confidence.

  3. 03

    Users must only see the data they are entitled to.

  4. 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

  1. 01

    A business question

    “What were our top 3 selling categories in Q4, by region?”

  2. 02

    The right schema, found

    Among 140 tables, the agent finds the three that matter: sales, products, stores.

  3. 03

    A query generated

    The SQL is written and run read-only, with the user’s rights.

  4. 04

    Fixed when needed

    The database returns an error? The agent reads it, understands and rewrites the query.

  5. 05

    An explained result

    A table, a chart and one sentence to understand the figure.

Results

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

A similar project? Let’s talk
Next case · Calvera AssurancesModernising 30-year-old software without risking how premiums are calculated

Illustrative cases: clients and figures are fictional, representative of the solutions we deliver.