If you live in the terminal and work with PostgreSQL daily, this is for you.
Why I built this
I've been bouncing between DBeaver, DataGrip, and various CLI tools for years. None of them hit the sweet spot I was looking for:
-
Zero-setup. I didn't want to install database drivers or configure connection pools. If you have
psql, you should be good to go. - Minimal, vim-like UX. I wanted something like oil.nvim for databases. Something that appears when you need it and disappears when you don't. No permanent sidebar eating your screen real estate.
- ER diagrams in the terminal. DBeaver and DataGrip can do this, but no TUI tool could. I wanted to stay in my terminal.
So I built sabiql.
sabiql
A fast, driver-less TUI to browse, query, and edit PostgreSQL databases — no drivers, no setup, just psql.
Concept
sabiql wraps your existing psql CLI — no Rust database drivers, no connection pools, no extra dependencies. Point it at your database and get a full-featured TUI with vim-like keybindings.
Built in Rust for minimal memory footprint and near-zero idle CPU — no runtime, no GC pauses.
Features
Core
-
SQL Modal (
s) — Ad-hoc queries with auto-completion for tables, columns, and keywords -
ER Diagram (
e) — Generate relationship diagrams via Graphviz, opened instantly in your browser -
Inspector Pane (
2) — Column details, types, constraints, and indexes for any table
Editing
-
Inline Cell Editing (
ein Result) — Edit cells in-place with a guarded UPDATE preview before committing -
Row Deletion (
ddin Result) — DELETE with mandatory preview; risk level color-coded (yellow/orange/red) - …
After releasing it, orhun (a Ratatui maintainer) gave it a shout-out, it got listed on awesome-ratatui, and Postgres Weekly picked it up. Since then, I've been getting feature requests via issues and steadily shipping them.
Design philosophy
Drew Neil, the creator of vim-vinegar, once wrote:
"Split windows and the project drawer go together like oil and vinegar. I don't mean to say that you can combine them to create a delicious salad dressing. I mean that they don't mix well!"
— Drew Neil, Oil and vinegar
oil.nvim inherited this idea, treating file operations as regular buffers instead of a persistent sidebar.
sabiql takes a similar approach for databases. SQL modals, ER diagrams, and query results are independent overlays you summon and dismiss. When you need to dig deeper, toggle focus mode for a full-screen view. No mouse, no extra windows, just keyboard-driven context switches that stay out of your way.
Features
1. Connection Management
Enter your connection details on first launch. They're saved to ~/.config/sabiql/connections.toml, so you never have to type them again. Editing existing connections is supported too.
I recently added pg_service.conf support too, so you can reuse your existing service definitions.
Connection errors can be yanked to clipboard.
2. Inspector Pane (7 tabs of metadata)
Once connected, you get an Explorer (table list) and an Inspector pane with 7 tabs:
| Tab | What it shows |
|---|---|
| Info | Owner, comment, estimated row count, schema |
| Cols | Column name, type, nullable, PK, default, comment |
| Idx | Index name, target columns, type (btree/hash/gin…), uniqueness |
| FK | Foreign key name, referenced table, columns |
| RLS | RLS enabled/disabled, policy name, command, PERMISSIVE/RESTRICTIVE |
| Trig | Trigger name, timing, event, function name |
| DDL | Auto-generated CREATE TABLE statement (yankable) |
This is especially useful for quick security checks. You can instantly see which tables have RLS, who owns them, and whether a given role might bypass policies.
3. Inline Edit & Row Deletion
Edit cells in-place. Before execution, you get a preview of the exact SQL that will run so you can verify the change.
There are a couple of safety guards baked in. If there's no WHERE clause, execution is blocked so you don't accidentally mass-update. Same thing if the row can't be uniquely identified.
You can also do vim-style dd then :w for row deletion, with a preview confirmation step.
4. SQL Modal with Auto-Completion
Press s to open the SQL modal. It auto-completes table names, column names, and SQL keywords right inside the TUI, so you don't need a separate tool for ad-hoc queries.
5. ER Diagram Generation
I haven't seen another TUI database tool that does this.
Press e to generate an ER diagram and open it in your browser. You can also generate focused diagrams for specific tables only.
6. Vim-like Navigation & Command Palette
-
j/kfor scrolling,g/Gfor jump to top/bottom -
ffor focus mode (expand any pane to full screen) -
Ctrl+Kfor the command palette -
?for the complete keybindings reference
7. Inherits Your Terminal Theme
sabiql follows your terminal's color scheme, transparency included.
Under the hood
The "no driver" approach means sabiql spawns psql as a subprocess for every query, including user-issued SELECTs and INSERTs. This keeps dependencies minimal, but spawn costs add up fast when you're bulk-fetching metadata at startup.
Here's what I did about it.
Prefetch optimization for auto-completion
The auto-completion engine needs metadata for all tables. My first implementation ran 6 queries per table, so for a database with 538 tables, that's 3,228 psql spawns just to populate completions.
I replaced that with a single lightweight query that fetches only the columns and foreign keys the completion engine actually uses, skipping indexes, RLS, and triggers entirely.
Spawn count dropped to 1/6, and the CPU spike went from 3-5 seconds down to under 100ms (tested on a 538-table database).
Two-tier caching
Explorer, SQL completion, and ER diagram generation all fetch metadata, so caching matters a lot on large databases. I split it into two tiers based on access patterns.
Tier 1 is a TTL cache (5 min) for the table list and schema info. Explorer and SQL completion initialization hit this. The data rarely changes, so a time-based expiry works well.
Tier 2 is an LRU cache for per-table column and FK details. SQL completion and ER diagram generation share this, so if completion already warmed up a table, ER diagram generation doesn't refetch it.
One exception: ER generation intentionally bypasses Tier 1 and always fetches fresh data. I want ER diagrams to always reflect the current state. To keep this efficient, it checks MD5 signatures from pg_catalog for change detection and only refreshes Tier 2 entries for tables that actually changed. So even right after an ALTER TABLE, the diagram is accurate without a full refetch.
Installation
# macOS / Linux
brew install riii111/sabiql/sabiql
# Cargo (crates.io)
cargo install sabiql
# Arch Linux (AUR)
paru -S sabiql # or yay -S sabiql
# FreeBSD (ports)
cd /usr/ports/databases/sabiql/ && make install clean
# Install script
curl -fsSL https://raw.githubusercontent.com/riii111/sabiql/main/install.sh | sh
Run sabiql, enter your connection on first launch, and press ? for help.
You'll need the psql CLI (you probably already have it). Graphviz is optional, only needed for ER diagrams (brew install graphviz).
What's next
-
EXPLAINanalysis visualization - CASCADE delete visualization
- Query history persistence
- Cloud SQL / AlloyDB connection support
- MySQL support (eventually)
Try it out
I use sabiql daily and maintain it actively. If you're a terminal-first developer who works with PostgreSQL, give it a spin.
Feedback, feature requests, and bug reports are very welcome on GitHub Issues.
sabiql
A fast, driver-less TUI to browse, query, and edit PostgreSQL databases — no drivers, no setup, just psql.
Concept
sabiql wraps your existing psql CLI — no Rust database drivers, no connection pools, no extra dependencies. Point it at your database and get a full-featured TUI with vim-like keybindings.
Built in Rust for minimal memory footprint and near-zero idle CPU — no runtime, no GC pauses.
Features
Core
-
SQL Modal (
s) — Ad-hoc queries with auto-completion for tables, columns, and keywords -
ER Diagram (
e) — Generate relationship diagrams via Graphviz, opened instantly in your browser -
Inspector Pane (
2) — Column details, types, constraints, and indexes for any table
Editing
-
Inline Cell Editing (
ein Result) — Edit cells in-place with a guarded UPDATE preview before committing -
Row Deletion (
ddin Result) — DELETE with mandatory preview; risk level color-coded (yellow/orange/red) - …
If you found this useful, a ⭐ on the repo would mean a lot!










Top comments (0)