FIX
← Signals
Data & AI

LLMs for eCommerce data analysis: talking to your data in plain English

How to build a safe text-to-SQL layer over an eCommerce data warehouse (Magento, Shopify, Klaviyo, GA4) so marketing and founders can ask questions in natural language and get reliable answers.

10 Giu 2026 · 10 min · Alberto Sepe

eCommerce text-to-SQL is an AI interface that turns natural-language questions ('how much did I sell last week vs last year, excluding Black Friday?') into SQL against the data warehouse, executes them and returns the answer with a chart. It absorbs 70% of the 'please pull a report' requests currently saturating the data team.

Stack we use: warehouse on BigQuery or Postgres, a semantic layer (Cube.js or dbt metrics) that exposes pre-aggregated metrics and security constraints, an LLM (Claude or GPT-4o) that generates SQL only against authorized views, an executor with hard timeout and row limit, a renderer that picks table vs chart.

The semantic layer is what makes it safe and reliable. Without it, the LLM invents JOINs between raw tables and returns plausible but false numbers. With a semantic model, the AI composes validated metrics: 'revenue', 'orders', 'AOV', 'active customers' have one definition.

Security: read-only DB user, schema whitelist, prompt-injection filter, full audit log of every query and requester. Never let the LLM run DDL or mutate data. Row-level security per team: marketing sees everything but COGS, finance sees margins, a 'client' role only sees its own brand if the warehouse is multi-tenant.

The game-changer for eCommerce is cross-source correlation in one question: 'Which categories have the best ROAS in the last 30 days AND the worst 90-day retention?' The AI joins Magento, GA4 and Meta Ads data without anyone designing the report.

Typical setup on a €15M/yr client: 3 weeks to implement, ~1,200 monthly queries generated, 68% drop in ad-hoc requests to the data team. LLM cost ~€180/month. Payback well under 3 months.

Want to talk?

Every signal comes from a real project.

Get in touch →