Open source

Ask your database in plain English, no cloud required

A semantic layer for PostgreSQL powered by local inference with Ollama.

Kevin Keller · kevinkeller.org

Why it matters

People need answers but don't speak SQL

  • BI dashboards and data catalogs need upfront effort to build and maintain.
  • Managed text-to-SQL services lock you in.
  • Many also send your schema and data to external APIs.

Architecture

Three layers turn a schema into answers

  1. Introspection: reads pg_catalog for tables, columns, types and relationships.
  2. Semantic enrichment: Ollama writes descriptions for every table and column and flags PII.
  3. Query translation: plain English to SQL, using the descriptions as context.

The key differentiator

Failed queries correct themselves

When generated SQL fails, the error, the question and the failed SQL go back to the model, which writes a corrected query. The user just sees the fixed result.

The interface

Three panels: explore, model, ask

  • Schema explorer: one click auto-describes every table and column
  • Semantic canvas: tables as nodes, foreign keys as edges, arranged your way
  • Several models per database: sales and engineering see different views
  • Chat: generated SQL shown for review before it runs

Why local matters

Local inference changes what is possible

Cloud text-to-SQLPostgres Analyst
SchemaSent to external APINever leaves your network
Data in promptsSample rows oftenOnly metadata
CostPer tokenFree after hardware
AvailabilityVendor uptimeWorks offline

The idea

The model sees descriptions, not data.

Only metadata goes into prompts, which removes a whole class of GDPR, DORA and NIS2 concerns.

PII protection

The model knows a column exists. The screen never shows its values.

  • Detects emails, phone numbers, national IDs and names.
  • Flagged columns stay visible to the model for correct joins.
  • Values can be masked in results, for example @.com.

What it is and isn't

An educational proof of technology

  • No authentication, multi-user support or query cost controls.
  • The patterns match production systems: introspection, enrichment, self-correction, PII detection.
  • Small on purpose: one FastAPI file and four Preact components.

The takeaway

A local model plus a semantic layer gets you plain-English SQL on your own hardware.

Read the full article

Kevin Keller · kevinkeller.org · Educational proof of technology, not a production data platform