OriginChainDB docs
nql · by industry

Natural-language querying by industry

Natural language is worth it where the questions are many and unpredictable, and the asker cannot write SQL. Each of these pairs the convenience with the guardrail it needs.

Operations: the question nobody wrote a dashboard for

Dashboards answer the questions someone anticipated. Incidents produce the others.

Ask it directly

No ticket to the data team, no new panel, and the answer comes from live rows rather than yesterday's export.

{ "nl": "which services had more than 50 errors in the last hour?" }
show the plan next to the answer

An operator acting on a number needs to know which table it came from. Return the plan alongside the rows and the answer becomes checkable.

Finance: self-service without a warehouse export

The recurring monthly questions are known; the follow-ups are not.

Scope it and ask

Naming the schemas keeps the compiler on the tables that hold the truth, and keeps it away from ones it should not touch.

{ "nl": "settled volume by currency last month", "schemas": ["fin.payments"] }
permissions still apply

NQL runs the plan as the caller. Row-level security and column masking apply to the generated query exactly as to a hand-written one, so a natural-language interface cannot become a way around them.

Support: triage in the agent's own words

An agent asks about a customer mid-conversation and needs the answer now, not a query builder.

One sentence, one answer

Ordinary phrasing, over the same tables the product writes to.

{ "nl": "open tickets for acme corp older than three days" }

Internal tools: an assistant with a real backend

The assistant should read the database, not a copy of it, and should be honest when it cannot.

Plan first, then run

Compile without executing, check the plan against what the user is allowed to ask, then run it. That sequence is what makes an assistant safe to point at production.

{ "nl": "...", "plan_only": true }   // inspect
{ "nl": "..." }                   // then execute
an agent can call this directly

The MCP server exposes ask, SQL, vector and search as tools, so an AI IDE or agent can use these surfaces without bespoke glue.

What these have in common

  • The plan is the trust boundary. Inspect it and natural language becomes a query surface rather than a guess.
  • Scope beats cleverness. Naming the schemas is the single biggest improvement in both accuracy and latency.
  • Your policies still hold. The generated query runs as the caller, under the same row and column rules.