Skip to content
Querion

Docs / Documentation

Querion

A strictly read-only, natural-language data analyst for Postgres and HTTP APIs

pip install -e ".[all]"
  • v0.1.0
  • MIT
  • Python
On this page
  1. First principles
  2. Who it is for
  3. Minimal example
  4. What it does
  5. What it does not do
  6. Where to go next

Querion is a natural-language data analyst that only reads. You point it at a Postgres database and at read-only web application programming interfaces (APIs), then ask questions in plain English. It replies with a headline number, a table, the Structured Query Language (SQL) it ran, and a chart when one helps.

It uses your locally authenticated Claude Code command-line interface (CLI) as its reasoning engine. There is no API key to manage. The model runs under your existing Claude Code login.

"new vs returning customers this month, with a chart"
   -> Querion plans read-only steps
   -> runs SELECTs on Postgres and GETs on your APIs
   -> replies with the number, a table, a chart, and the SQL it used

First principles

A data analyst does three things: decides what to read, reads it, and explains what it means. A language model can decide and explain. Reading is where a model meets real systems, and where a mistake or a manipulated prompt could become a write.

So Querion splits the work. The model only writes text. To read data, it writes a fenced request, one SELECT or WITH query or one GET request, and Querion checks and runs that request itself through code that has no write path.

Code checks are a backstop, not the guarantee. Only Postgres and your APIs can enforce read-only access for certain, so the strongest protection is a read-only database role and read-only API tokens. How it works walks through the full design.

Who it is for

Teams that have the data but not the analyst time. Dashboards answer the questions you planned for. Querion is for the long tail of one-off questions that otherwise become tickets. It is safe enough to point at a production database when you follow the safety model.

Minimal example

git clone https://github.com/anishfyi/querion.git
cd querion
pip install -e ".[all]"
cp querion.example.yaml querion.yaml
cp .env.example .env          # set QUERION_DATABASE_DSN to a read-only role
querion check
querion ask "how many orders were placed in the last 7 days?"

The full walkthrough is in Quickstart.

What it does

  • Answers questions from Postgres (one SELECT or WITH statement per query) and from web APIs (GET requests only).
  • Combines both kinds of source in one answer, choosing the source per question.
  • Shows its SQL. The web user interface (UI) lists every statement that ran without error. In the terminal, the answer includes the query the model reports.
  • Draws bar, line and pie charts: image files rendered with matplotlib in the CLI, or specs drawn by Chart.js in the web UI. Without matplotlib, the model gets a text chart instead.
  • Serves a small web UI and a JavaScript Object Notation (JSON) API with querion serve.
  • Caps questions per caller per day in the web server.
  • Optionally reads a semantic layer maintained by Trove.

What it does not do

  • It does not write to Postgres or to any API. The safety model shows exactly what is checked and where the checks stop.
  • It has no login. Put the web server behind your own authentication.
  • It does not call the Anthropic API directly. It runs the claude CLI, which must be installed and logged in on the host.
  • It has no chat-app integration, such as Slack or WhatsApp. Only the CLI and the web server ship in the repository.

Where to go next