Quarry
A database workbench for developers and their AI agents. Save a SQL query once, inspect its rows in the browser, run it from a script, or ask an agent to run it by name. All three use the database connections and SQL files in the same workspace.
Website · Quickstart · Self-hosting · 简体中文
Run your first saved query
Install Quarry on macOS or Linux with an arm64 or x86_64 processor. The native executable includes the browser workbench and database drivers.
curl -fsSL https://yiminspace.github.io/quarry/install.sh | sh
The installer puts qy in ~/.local/bin. Add that directory to your PATH if your shell cannot find it. For platform requirements, archive checksums and updates, see the installation guide.
How many orders are open? With the sqlite3 command installed, create a temporary workspace and a three-row database. This example runs entirely on your computer.
demo=$(mktemp -d)
sqlite3 "$demo/shop.db" <<'SQL'
CREATE TABLE orders(status TEXT);
INSERT INTO orders VALUES ('open'), ('shipped'), ('open');
SQL
qy --workspace "$demo" connections add shop --url sqlite:///shop.db
Save the query as open_orders and run it against shop.
qy --workspace "$demo" save open_orders --db shop \
--sql "SELECT COUNT(*) AS open_orders FROM orders WHERE status = 'open'"
qy --workspace "$demo" run open_orders
[{"open_orders":2}]
Quarry saved the SQL to queries/shop/open_orders.sql in your workspace. Edit that file to change what the browser, scripts and agents run.
Use the same query elsewhere
| Where | Try it |
|---|---|
| Browser | Run qy --workspace "$demo" gui. Open open_orders from the saved queries and run it in the editor. The SQL assistant can suggest changes for you to review. |
| Script | Run qy --workspace "$demo" run open_orders --format csv for a CSV report. The default JSON row array goes to stdout, so a script can read the result directly. |
| AI agent | Run printf '%s\n' "$demo" to get the workspace path. Configure your MCP client to launch qy with arguments ["--workspace", "/absolute/path/to/workspace", "mcp"], substituting that path. Ask it to run the saved query open_orders using Quarry. |
For your own database, define the connection in connections.toml. Quarry supports PostgreSQL, MySQL, SQLite and Redis, with experimental Amazon Neptune support. Group connections by environment, or register a provider to see the cloud databases you can access alongside local connections. Example workspace · Cloud database providers · Database support
Control database access
The browser query editor and the MCP run_saved_query tool execute read-only queries. CLI writes require --write. Connections marked production = true also require confirmation. To allow an agent to write through exec_sql, start the MCP server with --write and authorize the individual call with write: true. Production calls additionally require confirm_prod: true. Query permissions and result limits
For a team, the hosted workbench serves a read-only browser interface from a Docker image. Database credentials stay on the server. Configure access per database and sign in with a built-in administrator or your existing identity provider. Self-hosting guide
Develop and extend
Build the web assets before compiling the Rust executable that embeds them.
npm --prefix web ci && npm --prefix web run build
cargo build --release --locked -p quarry-cli
cargo test --workspace --all-targets --locked
Develop the browser workbench with hot reload
Run qy gui --no-browser in one terminal, then npm --prefix web run dev in another. Open the Vite URL ending in /quarry/. Vite forwards API calls to the Rust workbench on port 8765. If the workbench uses another port, set QUARRY_DEV_API_PORT when starting Vite.
Use qy gui stop to stop the local workbench. If you set a workspace, config, host or port at launch, pass the same options when stopping it. For --port 0, use the port printed at startup.
Contributing · GUI feature matrix · Rust embedding example · MIT license