01 / 06 資料
QueryLion
可
A self-hostable natural-language data analysis agent for PostgreSQL
用
Ask in Chinese or English. Get a chart back, not just a table to export.

(01) 為什麼Why
資料
Data lives in PostgreSQL, and non-engineers queue for someone to write SQL — yet letting an AI loose on a production database risks deleted rows, overloaded servers and leaked columns. QueryLion lets the agent explore the schema and write read-only SQL, and every write shows you a diff first.
(02) 06 項items
它做什麼What it does
-
01
唯讀
SQL, Read-only SQL that repairs itself自動 修正 Agent
探索 Schema、 產生 並 執行 唯讀 SQL, 出錯 時 自動 修正, 最多 3 次。 The agent explores the schema, generates and runs read-only SQL, and fixes its own errors up to 3 times.
-
02
8
種 8 controlled chart components受 控 圖表 元件 KPI、
折線、 長條、 樞紐、 表格、 散佈、 熱 圖、 漏斗, 以 Zod 驗證; 可 切換 圖表 並 匯出 CSV / PNG。 KPI, line, bar, pivot, table, scatter, heatmap and funnel, validated with Zod — switch charts and export CSV / PNG.
-
03
雙層
查詢 Two-layer query guard防護 資料庫
層 READ ONLY交易 與 statement_timeout; 應用 層 以 AST 驗證 只 允許 SELECT/ WITH、 白 名單 資料 表 與 函式, 並 遮罩 敏感 欄位。 Database-level
READ ONLYtransactions andstatement_timeout; app-level AST validation allows onlySELECT/WITH, whitelisted tables and functions, and masks sensitive columns. -
04
寫入
前 Human approval before any write人工 核准 INSERT/ UPDATE/ DELETE先 Dry- run 產生 逐 列 差異 後 ROLLBACK, 以 HMAC 防 篡改; 超過 門檻 (預設 50 筆) 需 二次 確認, 全部 寫入 稽核 日誌。 INSERT/UPDATE/DELETEdry-run into a row-level diff, thenROLLBACK, HMAC-protected; above a threshold (50 rows by default) a second confirmation is required, and everything lands in an audit log. -
05
Schema
語意 Schema annotations註解 在
介面 直接 編輯 欄位 說明, 存 於 querylion.config.json。 Edit column descriptions right in the UI; they are saved to
querylion.config.json. -
06
BYOK,
自備 Bring your own model模型 OpenAI、
Anthropic、 Google Gemini 或 OpenAI 相容 端點 (含 Ollama)。 金 鑰 加密 存在 伺服器 本機, 畫面 只 顯示 遮罩。 OpenAI, Anthropic, Google Gemini or any OpenAI-compatible endpoint (including Ollama). Keys are encrypted on your server and only ever shown masked.
(03) 怎麼
一個問題的旅程The life of a question
- 01
提問Ask
用
中文 或 英文 輸入 問題。 Type a question in Chinese or English.
- 02
探索
Schema ExploreAgent
讀取 資料 表 結構 與 你 寫的 欄位 註解。 The agent reads the schema and your column notes.
- 03
唯讀
執行 Run read-onlyAST
檢查 後 在 唯讀 交易 中 執行, 錯誤 時 最多 自動 修正 3 次。 AST-checked, run in a read-only transaction, auto-repaired up to 3 times.
- 04
呈現Render
從
8 種 元件 挑出 圖表 或 表格。 Picks a chart or table from 8 components.
- 05
核准
寫入 Approve writes若要
寫入, 先看 Dry- run 差異, 由 人 核准。 Writes wait for you behind a dry-run diff.
(04) README
快速開始Quick start
首次
First start seeds a PGlite e-commerce demo (50,000 orders). Demo mode only answers the scripted demo questions; paste a key in Settings → Model & connection to go live.
npm ci
npm run dev
# open http://127.0.0.1:5173
docker compose up --build
# open http://127.0.0.1:3001
(05) 實測Measured
真實模型實測Real-model evaluation
2026-claude-haiku-5-5claude-haiku-5-5
| 正確 | 修復 | 圖表 | 成本 | P50 |
|---|---|---|---|---|
| 96.7% | 100% | 56.7% | US$0.00156 | 1.6 s |
(06) 安全
安全與權限Safety & permissions
- 只靠
prompt Not prompt-only: a read-only database role plus SQL AST checks.不夠: 唯讀 資料庫 角色 + SQL AST 檢查 雙層 防護。 - 寫入
預設 Writes are off by default; when enabled they always dry-run, need approval and are audit-logged.關閉; 啟用 後 一律 Dry- run、 人工 核准、 寫入 稽核 日誌。 - 可
選 Optional OIDC with viewer / analyst / approver roles — nobody approves their own change.OIDC 登入, 角色 viewer / analyst / approver, 不可 核准 自己 提出 的 變更。 - 自
架: Self-hosted: API keys and data stay in your environment.API 金 鑰 與 資料 都 留在 你的 環境。
目前狀態 Status
- Repo
目前 Repo currently private — coming to open source.為 私有, 準備 開源 中。 - README
宣告 README declares the MIT licence.MIT 授權。
想先試用 QueryLion?Want to try QueryLion early?
所有