← Back to projects
Analytics
NL2SQL Data Agent
OLAP analytics agent that turns business questions into guarded SQL behind a deterministic SQLGlot safety layer, with a semantic metadata layer and bounded repair.
How it works
A Vue interface sends questions to a FastAPI agent workflow that selects a datasource, retrieves semantic context (Qdrant-augmented), generates guarded SQL, executes read-only queries, and returns summaries, explanations, and chart recommendations.
Vue 3FastAPISQLGlotQdrantDuckDBClickHouse
Capabilities
- Semantic metadata layer (tables, columns, metrics, aliases, verified queries, relationships) for scoped retrieval instead of full-schema dumps.
- Deterministic SQLGlot guard: SELECT-only, scope checks, dangerous-command blocking, fanout detection, and auto-LIMIT.
- Bounded repair loop that re-validates repaired SQL before execution.
- OLAP intent handling (TopN, share, YoY, moving averages) across DuckDB and ClickHouse.
- Automatic chart recommendations and read-only MCP servers reusing the same guard.
Evidence
- 76-case result-equivalence smoke suite across DuckDB and ClickHouse.
- Dangerous SQL is blocked before execution.
- Qdrant-backed semantic layer cuts prompt context ~73% vs full-schema dumps.
Try this
- Ask for recent daily sales and order count.
- Break results down by region, then filter to one region.
- Try a destructive SQL request and verify that it is blocked.