https://github.com/riii111/sabiql
A fast PostgreSQL TUI written in Rust โ driver-less, vim-first, with ER diagrams. No database drivers, no setup, just psql
https://github.com/riii111/sabiql
postgresql ratatui rust tui
Last synced: 25 days ago
JSON representation
A fast PostgreSQL TUI written in Rust โ driver-less, vim-first, with ER diagrams. No database drivers, no setup, just psql
- Host: GitHub
- URL: https://github.com/riii111/sabiql
- Owner: riii111
- License: mit
- Created: 2025-12-27T05:01:13.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-04-24T20:46:03.000Z (26 days ago)
- Last Synced: 2026-04-24T21:31:08.947Z (26 days ago)
- Topics: postgresql, ratatui, rust, tui
- Language: Rust
- Homepage:
- Size: 4.16 MB
- Stars: 165
- Watchers: 0
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rust - sabiql - A fast, driver-less TUI to browse, query, and edit PostgreSQL databases. [](https://github.com/riii111/sabiql/actions/workflows/ci.yml) (Applications / Database)
- awesome-ratatui - sabiql - A fast, driver-less TUI for browsing, querying, and editing PostgreSQL databases with vim-like keybindings. (๐ป Apps / โจ๏ธ Development Tools)
- awesome-postgres-with-stars - sabiql - less TUI to browse, query, and edit PostgreSQL databases. | 2026-04-05 | (CLI)
- awesome-rust-with-stars - sabiql - A fast, driver-less TUI to browse, query, and edit PostgreSQL databases. | 2026-03-07 | (Applications / Database)
- fucking-awesome-rust - sabiql - A fast, driver-less TUI to browse, query, and edit PostgreSQL databases. [](https://github.com/riii111/sabiql/actions/workflows/ci.yml) (Applications / Database)
README
# sabiql

A fast, driver-less TUI to browse, query, and edit PostgreSQL databases โ no drivers, no setup, just `psql`.
[](https://github.com/riii111/sabiql/actions/workflows/ci.yml)
[](https://opensource.org/licenses/MIT)
## Concept
> Vim-first ยท Safe by design ยท Oil-and-vinegar UI ยท Fast and lightweight
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. Your `psql` config, `.pgpass`, SSL setup all just work.
Inspired by [oil.nvim](https://github.com/stevearc/oil.nvim)'s "oil and vinegar" philosophy: UI elements appear only when needed, never occupying your screen permanently. Vim-native keybindings (`j/k`, `dd`, `/`) let you navigate and edit without leaving your muscle memory.
Destructive operations are guarded. Inline edits and row deletions always show a preview modal before touching your data. Read-only mode (`Ctrl+R`) goes further โ block all writes at the PostgreSQL session level with a single keystroke.
Built in Rust for minimal memory footprint and near-zero idle CPU. A full-featured alternative to GUI tools like DBeaver or DataGrip, without ever leaving the terminal.
## Features

### Core
- **Read-Only Mode** (`Ctrl+R`) โ Toggle safe-browse mode; writes are blocked at both app and DB session level
- **SQL Modal** (`s`) โ Ad-hoc queries with auto-completion for tables, columns, and keywords; browse past results with `Ctrl+H`; recall previous queries with `Ctrl+O`
- **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** (`e` in Result) โ Edit cells in-place with a guarded UPDATE preview before committing
- **Row Deletion** (`dd` in Result) โ DELETE with mandatory preview; risk level color-coded (yellow/orange/red)
- **Yank** (`y`) โ Copy any cell value to clipboard
- **CSV Export** (`Ctrl+E`) โ Export query results to a CSV file
### Query Analysis
- **EXPLAIN / EXPLAIN ANALYZE** โ Run your query, then switch tabs to instantly view its execution plan. Compare two plans side-by-side to pinpoint performance bottlenecks โ no copy-paste, no external tools, all within the same modal.
### Navigation
- **Fuzzy Search** (`/`) โ Incremental table filtering
- **Focus Mode** (`f`) โ Expand any pane to full screen
- **Command Palette** (`Ctrl+K`) โ Searchable command list
## Installation
```bash
# macOS / Linux
brew install riii111/sabiql/sabiql
# Cargo (crates.io)
cargo install sabiql
# Arch Linux (AUR)
paru -S sabiql # or yay -S sabiql
# Void Linux (Unofficial Repo)
echo repository=https://raw.githubusercontent.com/Event-Horizon-VL/blackhole-vl/repository-x86_64 | sudo tee /etc/xbps.d/20-repository-extra.conf
sudo xbps-install -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
```
## Quick Start
```bash
sabiql
```
On first run, enter your connection details โ saved to `~/.config/sabiql/connections.toml`. Press `?` for help.
## Requirements
- `psql` CLI (PostgreSQL client)
- Graphviz (optional, for ER diagrams): `brew install graphviz`
## Development
With Nix:
```bash
direnv allow
cargo nextest run --workspace
nix build
```
Without direnv, enter the shell explicitly:
```bash
nix develop
```
## Environment Variables
| Variable | Description |
|----------|-------------|
| `SABIQL_BROWSER` | Browser for ER diagrams (e.g., `Arc`, `Firefox`). macOS uses `open -a`; falls back to OS default. |
## Roadmap
- [x] Connection management UI
- [x] ER diagram generation
- [x] Read-only mode (`Ctrl+R`)
- [x] SQL modal with DML/DDL safety guardrails
- [x] Query history persistence & fuzzy search
- [x] CSV export & clipboard yank
- [x] EXPLAIN workflow (plan tree view & comparison)
- [x] JSON/JSONB support (tree view, editing, validation)
- [ ] Neovim integration (`sabiql.nvim`)
- [ ] SQLite support
- [ ] Zero-config connection (env vars, `.pgpass`, URI auto-detect)
- [ ] Google Cloud SQL / AlloyDB support
- [ ] Theme switching (foreground palette only)
- [ ] MySQL support
Have a feature request? [Open an issue](https://github.com/riii111/sabiql/issues/new) feedback is welcome!
## License
MIT โ see [LICENSE](LICENSE).