quarry

A modern SQL client, smart and fast that lives in your terminal.

Full-featured for PostgreSQL, MySQL / MariaDB and SQLite. Type SQL in a REPL that knows your schema, or explore in a full-screen TUI. One small binary, nothing else to install.

paru -S quarry-sql-bin

Other ways, and macOS, in the installation guide.

The quarry mascot: a stone database cylinder with a glowing crystal and a pickaxe

Go full-screen when you want to look around

quarry --tui, or \tui from the REPL, opens the same connection in a workspace: an explorer that writes SELECT and INSERT scripts for you, tabbed editors, a grid for large results, and a table view where edits are staged and applied in one transaction.

Tour the TUI

And script it

The same binary runs SQL from -e, a file or a pipe, and prints CSV, JSON, TSV or Markdown. Exit codes tell your scripts when something failed.

Scripts, exports and pipes

What else is in the box

Completion that reads your schema
Tables after FROM, the columns of the tables in your statement, whole JOIN โ€ฆ ON clauses from foreign keys, and fuzzy matching, so ui finds user_id.
Careful with real data
DROP, TRUNCATE and a DELETE without WHERE ask first. Read-only mode is enforced by quarry and by the server. Passwords stay out of history.
Every way in
URLs, psql and mysql flags, ~/.pgpass and ~/.my.cnf, TLS up to verify-full, SSH tunnels, and saved connections, tinted red for production if you like.
Ask for SQL in plain words
\llm top 10 customers by revenue writes SQL for your schema and waits for you to review it. Use an API key, Ollama, or the Claude Code or Codex you already have.
Output that fits where it goes
Tables that turn vertical when they are too wide, a pager for long results, and 17 formats from psql and Markdown to CSV, JSON and SQL INSERT.
Made yours
27 colour themes shared by the REPL and the TUI, your own palettes, any base16 or base24 scheme, and tab completion for bash, zsh and fish.

Start with a SQLite file

No server needed. quarry creates the file, and the quick start takes it from there.

quarry tour.db
Take the quick start