Introducing the 4-Month AI FrameworkRead the guide
Case StudiesDecision Intelligence

C-Suite Reporting Across the Data Warehouse

Text-to-SQL and Forecasting for a High-Throughput Retail Operator

Published · Updated

Client

InsightsBot

Headquarters

United States

Timeline

4 months

Technology

TEXT-TO-SQL & FORECASTING

C-Suite Reporting and Forecasting Across the Data Warehouse case study by EdgeFirm

Leadership queries the warehouse directly in plain language, client-reported

Sales swings are traced to specific campaigns and locations instead of guesswork, client-reported

At a glance

The challenge

Leadership questions required an analyst to hand-write SQL across Snowflake, BigQuery, Postgres, and other data lakes before an answer came back

The solution

A unified text-to-SQL layer over every warehouse, plus forecasting that ties sales swings to specific campaigns, launches, and locations

The results

  • Leadership queries the warehouse directly in plain language, client-reported
  • Sales swings are traced to specific campaigns and locations instead of guesswork, client-reported
The problem

C-Suite Reporting and Forecasting With Text-to-SQL

InsightsBot is a confidential engagement for a large retail and marketplace operator working with many high-throughput brands running concurrent campaigns, launches, and deliveries. The client is anonymized at their request; the scale is comparable to a large multi-brand marketplace such as eBay or Walmart, though we are not naming the actual client.

Before this build, answering a C-suite question meant an analyst hand-writing SQL against whichever warehouse held the relevant data, Snowflake, BigQuery, Postgres, or another data lake, then stitching the results together by hand. We built a unified text-to-SQL layer that lets leadership ask a question in plain language and get an answer sourced across every connected warehouse, plus forecasting that ties sales increases or drops to specific campaigns, product launches, and locations.

Scope of work

10 capabilities carried the build

Design and deploy a unified text-to-SQL and forecasting layer across Snowflake, BigQuery, PostgreSQL, and other data lakes, so leadership can query the business in plain language and see what drove sales up or down at the campaign and location level, without opening production warehouses to unchecked AI-generated SQL.

01

Data discovery across every warehouse, cataloguing schemas, access patterns, and update frequency before any query logic was written

02

ETL sync jobs that keep a trusted, query-ready copy of Snowflake, BigQuery, PostgreSQL, and other data lake sources current on a schedule

03

A multi-agent query system

A data expert agent, a SQL validator agent, and a security analyst agent, each with a narrow job

04

Hardcoded guardrails for database, infrastructure, and cloud operations that run regardless of what the agents decide

05

Manual validation of generated queries and their results against source data during testing, not spot checks

06

A feedback control system that routes corrected or rejected answers back into prompt and validation rule changes

07

Chart and figure rendering inside the conversational interface, chosen by the shape of the answer

08

Forecasting models tying sales movement to campaigns, launches, and locations

09

Load and scalability testing against production-scale data volumes before rollout

10

Security design following SOC 2 guidance, with per-warehouse and per-role access scoping

Technology

The stack behind it

Text-to-SQL, Snowflake, BigQuery, PostgreSQL, forecasting models

PostgreSQLPostgreSQL

Data Warehouses

Snowflake, BigQuery, and PostgreSQL, plus additional data lake sources

ETL

Scheduled sync jobs keeping a trusted, query-ready copy of every warehouse current

Query Agents

A data expert agent for schema and table selection, a SQL validator agent that checks every query against the real schema before it runs, and a security analyst agent that screens for out-of-scope data access

Guardrails

Hardcoded, rule-based checks for database operations, infrastructure operations, and cloud operations that do not depend on model judgment

Forecasting

Models linking sales movement to campaigns, launches, and location-level events

Feedback & Validation

Manual validation of queries and results during testing, plus a feedback control system that feeds corrections back into prompts and rules

Visualization

Charts and figures rendered inside the conversational interface, chosen by the shape of the answer

Infrastructure

Cloud-hosted pipelines with scheduled refresh, monitoring, and load testing at production-scale volumes

Security & Compliance

Access scoped per warehouse and per user role, with every generated query and its data access path logged, designed to SOC 2 guidance

How we built it

Our development process

Data Discovery and ETL Sync

Before writing any query logic, we mapped every data source the client's teams actually used, Snowflake, BigQuery, PostgreSQL, and several smaller data lakes, cataloguing schemas, access patterns, and update frequency. ETL jobs sync each source on a schedule into a layer the query system can trust, so a natural-language question always resolves against current data, not a stale snapshot.

A Team of Specialized Agents, Not One Do-Everything Model

Rather than pointing a single model at the warehouse, we split the work across agents with narrow jobs. A data expert agent understands each warehouse's schema and picks the right tables. A SQL validator agent checks every generated query against the real schema and known safe patterns before it runs. A security analyst agent screens for queries that could expose data outside a user's permission scope. Hardcoded, rule-based checks sit underneath the agents for database operations, infrastructure operations, and cloud operations, so the things that should never depend on model judgment do not.

Cutting Hallucinated Answers

We tested several model and prompting configurations before settling on the combination that produced the fewest hallucinated columns, tables, and numbers. During validation, every generated query and its result were checked manually against the source data, not spot-checked, which caught cases where a query ran successfully but returned a semantically wrong answer.

A Feedback Loop, Not a One-Time Launch

A feedback control system captures when a user corrects or rejects an answer, and that signal feeds back into prompt and validation rule changes instead of disappearing into a log. Prompts went through multiple optimization passes as real usage surfaced edge cases the original examples did not cover.

Answers Leadership Can See, Not Just Read

The system renders charts and figures directly inside the conversational interface when a question calls for a trend, a comparison, or a breakdown, choosing the chart type from the shape of the answer instead of returning a table every time.

Transparency

Scalability and Optimization Runs: Before rollout, the query layer went through repeated load and optimization passes against production-scale data volumes, to confirm response times held up under concurrent leadership usage rather than only in single-user demos.

After launch

Security Coverage and Compliance: The platform was designed to SOC 2 guidance. Access is scoped per warehouse and per user role, every generated query and its data access path is logged, and the security analyst agent's checks sit on top of each warehouse's own permission model rather than replacing it. EdgeFirm does not hold a SOC 2 certification; the design follows SOC 2 control guidance.

“EdgeFirm gave our leadership team a way to ask questions about the business directly, in plain language, instead of waiting on an analyst to write a query against the right warehouse. The forecasting work has made it much easier to see which campaigns and which locations actually moved the numbers, rather than guessing after the fact.”

Confidential client, Director of Analytics

After launch

What changed after launch

Direct Access to the Warehouse

Client-reported. Leadership asks questions in plain language and gets answers sourced across Snowflake, BigQuery, and Postgres, instead of waiting on an analyst to write and reconcile SQL by hand.

Campaign and Location-Level Forecasting

Client-reported. Sales increases and drops are now traced to specific campaigns, launches, and locations, replacing after-the-fact guesswork.

One Query Layer Across Every Warehouse

A single text-to-SQL layer spans Snowflake, BigQuery, PostgreSQL, and other data lakes, so no one is manually reconciling numbers between systems.

Fewer Hallucinated Answers

Several model and prompting configurations were tested, and every generated query and its result were checked manually against source data during validation, not spot-checked, to cut hallucinated columns, tables, and figures before launch.

Answers Leadership Can See, Not Just Read

The conversational interface renders charts and figures directly in the answer when a question calls for a trend, a comparison, or a breakdown, instead of returning a table every time.

Designed for Security and Scale

Access is scoped per warehouse and per user role, every generated query is logged, and the system was load-tested at production-scale data volumes before rollout. The design follows SOC 2 guidance; EdgeFirm does not hold a SOC 2 certification.

InsightsBot shows how a unified text-to-SQL layer and targeted forecasting can give leadership direct answers across a fragmented warehouse, Snowflake, BigQuery, Postgres, and other data lakes, without an analyst in the loop for every question. The key lesson is to make the query layer schema-aware across every warehouse before promising a single natural-language answer, and to tie forecasts to real campaign and location data rather than generic trend lines.

Talk to the founders

Get AI live in months, not years.

Book a 30-minute strategy call with the founders who will write your code.