Query Review
Review SQL For Meaning, Not Only Syntax
Every risky line gets a Query Receipt annotation in the margin — Base Grain Changed, Fanout Introduced, Filter Applied After Aggregation, Distinct Hides Duplication, Time Grain Shifted. Compare two receipts (before vs after) to tell an intentional business change from an accidental grain error.
SELECT c.customer_id, SUM(i.amount) AS mrrFROM customers cBase Grain ChangedJOIN contacts x ON x.customer_id = c.customer_idFanout IntroducedJOIN invoices i ON i.customer_id = c.customer_idWHERE c.plan = 'enterprise'Filter Applied After AggregationGROUP BY c.customer_idDistinct Hides DuplicationHAVING SUM(i.amount) > 0 -- as of this monthTime Grain ShiftedRow count6,412 → 14,738+130%
Receipt itemized — Open Grain Annotation on any tagged line for the full explanation.
- Review Query — paste or connect a query for grain review
- Open Grain Annotation — read why one line changed the grain
- Compare Query Versions — before vs. after a proposed edit
- Suggest Safe Rewrite — AI-proposed fix that preserves intent
- Approve Review — sign off before the query ships
A Correct Query Can Still Produce The Wrong Metric.
Illuminate The True Grain Of Every Metric.
GrainLux is the AI Semantic Data Reliability Layer between your warehouse and every model, metric, and dashboard built on top of it — grain-aware, metric-native, explainable, and deterministic.