AI Decision System
Replayable, offline-verifiable records for AI-assisted go/no-go decisions: experiment promotions, typed model answers and human-approved actions.
翻譯準備中
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證Multi-engine and Agentic AI SQL query router in Rust for all data platforms and lakehouses—with routing, queuing, guardrails, tracking, sqlglot dialect translation and more.
翻譯準備中
取自儲存庫 README
正在載入完整 README。
檢視完整 README ↗One query. Any engine.
Open-source SQL proxy and router in Rust — one endpoint for tools and AI agents across Trino, DuckDB, StarRocks, Athena, ClickHouse, and ADBC warehouses.
Documentation · Slack · Why a control plane · Quickstart
Modern stacks mix many engines — each with its own wire protocol and SQL dialect. QueryFlux sits between clients and those engines:
maxRunningQueries, queue at the proxy, fail-closed coordinationThe future of data platforms is not one engine — it is a control plane over specialized engines on shared data. Read The Future Isn't One Engine.
| Frontends | Trino HTTP :8080 · PostgreSQL wire :5432 · MySQL wire :3306 · Snowflake HTTP + SQL API v2 · Arrow Flight SQL · MCP |
| Engines | Trino · DuckDB (embedded) · StarRocks · Athena · ClickHouse · ADBC (Snowflake, Databricks, BigQuery, Redshift, …) |
| Routing | Protocol · header · regex · client tags · Python · compound AND/OR · fallback group |
| Control | Capacity leases & quotas · sqlglot translation · guardrails · OIDC/LDAP · OPA/Cerbos |
| Ops | Postgres or in-memory persistence · Studio UI · Prometheus + Grafana · Admin API (OpenAPI) · Helm chart · worker mode |
The Snowflake HTTP wire (JDBC/ODBC/Python, SnowSQL) and SQL API v2 share the snowflakeHttp listener; routing distinguishes snowflakeHttp vs snowflakeSqlApi. See config.example.yaml and the Snowflake frontend.
queryflux:
frontends:
snowflakeHttp:
enabled: true
port: 8443
routers:
- type: protocolBased
trinoHttp: trino-default
snowflakeHttp: duckdb-local
snowflakeSqlApi: duckdb-local
Studio is the web management UI, served on port 3000. It connects to the Admin REST API on port 9000.
Default login: username admin, password admin.
Security: Change the default password immediately after first login. Go to Security → Change password in Studio. The new password is stored as a bcrypt hash in Postgres and the default credentials are no longer used.
You can also set bootstrap credentials via YAML or environment variables:
queryflux:
adminApi:
port: 9000
username: admin # override with QUERYFLUX_ADMIN_USER
password: admin # override with QUERYFLUX_ADMIN_PASSWORD
Once the password has been changed through the UI, YAML/env credentials are ignored and the database record takes precedence. See the Studio docs for the full reference.
End-to-end overhead is measured by queryflux-bench (cargo build --release --bin queryflux --bin queryflux-bench, then target/release/queryflux-bench). It uses mock backends (a Trino HTTP coordinator and a StarRocks MySQL-wire FE) that answer instantly, 50 warmup queries per path, then 500 timed iterations — direct to the mock vs the same request through QueryFlux's Trino HTTP frontend. Overhead is the difference. Numbers below: median of 3 runs on an Apple M1 Max (10 cores, 32 GB); they vary by machine, so compare runs on the same one.
SELECT 1| p50 | p95 | p99 | |
|---|---|---|---|
| Direct | 0.09 ms | 0.13 ms | 0.15 ms |
| Via QueryFlux | 0.20 ms | 0.25 ms | 0.28 ms |
| Overhead | 0.12 ms | 0.13 ms | 0.13 ms |
SELECT 1| p50 | p95 | p99 | |
|---|---|---|---|
| Direct (one reused MySQL connection) | 0.03 ms | 0.09 ms | 0.12 ms |
| Via QueryFlux | 0.19 ms | 0.26 ms | 0.32 ms |
| Overhead | 0.16 ms | 0.17 ms | 0.20 ms |
Each feature scenario runs QueryFlux with one feature turned on; the dashboard-style query is the baseline, with none (QUERYFLUX_BENCH_SCENARIOS picks a subset):
| Scenario | p50 | p95 | p99 |
|---|---|---|---|
Dashboard-style query (CTE, join, filters, GROUP BY, LIMIT) | 0.09 ms | 0.12 ms | 0.12 ms |
| Translation, cache hit (same SQL repeated) | 0.11 ms | 0.12 ms | 0.12 ms |
| Translation, cache miss (new SQL every query) | 1.91 ms | 2.26 ms | 2.59 ms |
Built-in guards (read_only, row_limit, require_predicate) | 0.19 ms | 0.22 ms | 0.26 ms |
Python check(ctx) guard | 0.19 ms | 0.23 ms | 0.29 ms |
| Router chain (header, tags, regex, Python), none matching | 0.15 ms | 0.18 ms | 0.21 ms |
| Access control, OPA allows | 0.22 ms | 0.28 ms | 0.35 ms |
| Access control, OPA adds a row filter (query rewritten) | 2.47 ms | 2.92 ms | 3.67 ms |
| Result cache hit (no backend call) | 0.37 ms | 0.51 ms | 1.06 ms |
The two multi-millisecond rows are sqlglot running on every query: a translation-cache miss (repeated SQL is cached), and the row-filter rewrite, which is not cached yet.
make dev)make setup # Python deps (sqlglot)
make dev # Trino, Postgres, Prometheus, Grafana + QueryFlux
This starts:
| Service | URL |
|---|---|
| QueryFlux (Trino HTTP) | http://localhost:8080 |
| Admin / Metrics | http://localhost:9000/metrics |
| Trino (direct) | http://localhost:8081 |
| PostgreSQL | localhost:5433 |
| Prometheus | http://localhost:9090 |
| Grafana | http://localhost:3000 (admin/admin) |
curl -X POST http://localhost:8080/v1/statement \
-H "X-Trino-User: dev" \
-d "SELECT 42"
You can run QueryFlux natively with an embedded DuckDB engine without any containers:
# 1. Clone the repository
git clone https://github.com/lakeops-org/queryflux.git
cd queryflux
# 2. Install the binary globally (if linking fails, use `export DUCKDB_DOWNLOAD_LIB=1` before running this)
cargo install --path crates/queryflux
# 3. Automatically create a .venv and install Python dependencies (e.g., sqlglot)
queryflux --install-deps
# 4. Validate the config and environment
queryflux --config examples/cli-quickstart/config.yaml --validate
# 5. Start the proxy
queryflux --config examples/cli-quickstart/config.yaml
QueryFlux includes a provider-neutral Helm chart:
helm install queryflux ./charts/queryflux
kubectl port-forward svc/queryflux 3000:3000 8080:8080 9000:9000
See charts/queryflux/README.md for production values, external config, existing secrets, ingress, autoscaling, network policy, and Prometheus ServiceMonitor options.
make build
# or
cargo build --release
./target/release/queryflux --config config.yaml
Copy config.example.yaml and adjust for your environment:
queryflux:
externalAddress: http://localhost:8080
frontends:
trinoHttp:
enabled: true
port: 8080
persistence:
type: inMemory # or: postgres
clusterGroups:
trino-default:
engine: trino
maxRunningQueries: 100
clusters:
- name: trino-1
endpoint: http://trino-host:8080
auth:
type: basic
username: user
password: pass
duckdb-local:
engine: duckDb
maxRunningQueries: 4
clusters:
- name: duckdb-1
databasePath: /tmp/queryflux.duckdb
routers:
- type: protocolBased
trinoHttp: trino-default
- type: header
headerName: x-target-engine
headerValueToGroup:
duckdb: duckdb-local
routingFallback: trino-default
See config.example.yaml for the full reference including TLS, auth, query queuing, SQL translation, and Python script routing.
queryflux/
├── crates/
│ ├── queryflux/ # Main binary
│ ├── queryflux-cli/ # CLI logic and environment setup
│ ├── queryflux-core/ # Shared types and traits
│ ├── queryflux-config/ # Config loading
│ ├── queryflux-frontend/ # Protocol frontends (Trino HTTP, PG/MySQL wire, Snowflake HTTP, …)
│ ├── queryflux-engine-adapters/ # Backend engine adapters
│ ├── queryflux-cluster-manager/ # Load balancing and queueing
│ ├── queryflux-routing/ # Router implementations
│ ├── queryflux-persistence/ # State storage (in-memory / PostgreSQL)
│ ├── queryflux-sql/ # SQL parsing, classification, fingerprints, access extraction, translation
│ ├── queryflux-metrics/ # Prometheus metrics
│ ├── queryflux-auth/ # Authentication and authorization
│ ├── queryflux-bench/ # Proxy overhead benchmarks
│ └── queryflux-e2e-tests/ # Integration tests
├── examples/ # Docker Compose quickstarts (see examples/README.md)
├── grafana/ # Grafana dashboards
├── prometheus/ # Prometheus config
├── config.example.yaml
├── docker/
│ ├── docker-compose.yml # Local dev stack (`make dev`)
│ ├── fixtures/ # SQL init, test data (shared with examples)
│ ├── test/ # E2E stack: docker-compose.test.yml, fakesnow helpers
│ └── queryflux/ # QueryFlux Dockerfile
├── docs/ # Architecture markdown
├── website/ # Docusaurus documentation site
QueryFlux Studio is maintained separately in the queryflux-studio repository.
make dev # Start all services and run QueryFlux
make stop # Stop services
make logs # View logs
make check # Run tests and linting
make clean # Remove build artifacts and Docker volumes
See development.md for environment variables, workspace layout, and how to run the binary locally. See contribute.md for pull request expectations.
website/ → npm install && npm startApache License 2.0 — see LICENSE.