Skip to content

DB Engine overview

Pollen8 DB Engine

NL→SQL over the tenant’s own analytics warehouse. Gated on the pollenix.db entitlement.

This is not Pollen8’s own database. DB Engine connects to your Postgres / MySQL / BigQuery / Snowflake / Databricks / DuckDB and answers questions like “what’s our average days-in-A/R by payer this quarter” by emitting validated SQL and rendering the result as a table or chart.

What ships

  • Connections — tenant-supplied DB endpoints with encrypted creds, scope predicates, schema introspection.
  • Workbench — pick a connection, ask a question, see SQL + result + chart.
  • NL→SQL planner — sqlglot-validated SQL with EXPLAIN preflight, schema-embedded retrieval, AIProvider task-routed LLM call.
  • MCP tooldb.run_sql for downstream callers (chat orchestrator, BI widgets, agents).

What it isn’t

  • Read-only. No INSERT / UPDATE / DELETE / DROP. SELECT-only enforced at the validator layer; dangerous statements rejected.
  • Single-connection per query. No cross-connection JOINs.
  • Bounded. Statement timeout is 30s. EXPLAIN preflight blocks queries that would scan billions of rows.

Where it surfaces

  • /db — workbench landing for ad-hoc Q&A.
  • /admin/connections — connection CRUD + test.
  • /admin/connections/:id/edit — per-connection config + scope predicates.
  • Workbench’s chat surface routes “data” questions through the DB skill automatically when a connection is pinned.
  • BI satellite widgets — every widget owns a connection_id + a saved SQL/chart spec.

Stack

LayerTech
Validatorsqlglot — parse + rewrite + safety checks
Driversservices/db_drivers/ — per-kind adapters
Plannerservices/nl_to_sql.py — LLM (task=planner) + schema embeddings
PreflightEXPLAIN (FORMAT JSON) + pg_class.reltuples
Tooldb.run_sql MCP tool, AuthContext-gated

See Connections to wire up your first warehouse, then Workbench to ask your first question.