Flagship · 2024 – present · SynergyBoat
DeepQuery, plain-English access to your databases
Teams sit on databases their non-technical people cannot query. We built DeepQuery for one client's operations team: it discovers a schema and answers plain-English questions across Postgres, MySQL, and Mongo. It runs their reporting in production, and SynergyBoat is now making it a product other clients can point at their own databases.
The problem
A client’s non-technical operations team needed to answer business questions that lived across three databases: PostgreSQL for users and billing, MySQL for a legacy product system, and MongoDB for event logs. Every question cost an engineer’s day. Their founder needed that engineer back.
The obvious answer, train operators to write SQL, had failed twice before. The subtle answer was what we built: a text-to-SQL engine that was actually trustworthy across three dialects.
What shipped
A text-to-SQL engine that auto-discovers schemas across all three databases, classifies user intent against a small catalogue of query shapes, resolves ambiguous values (e.g., “last week” vs. an ISO date range), and generates optimized queries that stay inside an 8K-token context budget (Figure 1).
Live in production for that client. Their operators run their own reports, and the engineers they used to interrupt got those hours back. SynergyBoat is now turning the engine into a product other clients can point at their own databases.
Tokens are money and correctness simultaneously.
How it works
Four stages. Intent classification maps a natural-language request to a small
set of query shapes: analytics-style aggregates, lookup by entity, time-series
comparisons, or “I don’t know, ask me more.” Schema retrieval uses pre-computed
digests so the prompt never carries a full schema dump. Value resolution
handles ambiguity before the model generates, so "customers from last month"
becomes concrete dates and "premium users" becomes a resolved filter. Query
generation happens last, with the context budget enforced upstream so the model
never has to decide what to drop.
The key insight: every stage is a budgeting decision. Tokens are money and correctness simultaneously. Designing for the budget first made everything downstream simpler.
What I’d do differently
Caching the schema digests earlier would have saved weeks. The first version hit the databases on every query; observability eventually made it obvious, but the fix was a one-afternoon change that should have been there from day one.
Intent classification was also too ambitious early. The first version tried to handle open-ended requests; the working version has a clear “ask me more” branch that punts when confidence is low. That branch is the single biggest accuracy improvement we made.
| part | what it does |
|---|---|
| question | Plain English, from the operations team rather than an engineer. The one drawn is customers from last month. |
| intent classification | Maps the request to a small set of query shapes: analytics-style aggregates, lookup by entity, time-series comparisons, or ask me more. |
| ask me more | The branch that punts when confidence is low. |
| schema retrieval | Pre-computed digests, discovered across all three databases, so the prompt never carries a full schema dump. |
| value resolution | Resolves ambiguity before the model generates: last month becomes concrete dates, premium users becomes a resolved filter. |
| context budget | The ceiling is 8K tokens. The context fills toward it and stops short, enforced upstream, so the model never has to decide what to drop. |
| query generation | Runs last. The model is called only after the budget stops. |
| postgresql | Users and billing. The query drawn here routes here. |
| mysql | A legacy product system. |
| mongodb | Event logs. |