Skip to content

riii111/sabiql

Repository files navigation

sabiql

hero

A fast, driver-less TUI to browse, query, and edit PostgreSQL databases — no drivers, no setup, just psql.

CI License: 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'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

hero_1000_20fps

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
  • Settings (Ctrl+K) — Theme and ER diagram preferences
  • Command Palette (F1, :palette) — Searchable command list

Installation

# 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

sabiql

On first run, enter your connection details. They are saved to your platform config directory:

  • macOS: ~/Library/Application Support/sabiql/connections.toml
  • Linux: ~/.config/sabiql/connections.toml

Press ? for help.

Open Settings with Ctrl+K to switch themes and configure the ER diagram browser command.

Requirements

  • psql CLI (PostgreSQL client)
  • Graphviz (optional, for ER diagrams): brew install graphviz

Android / Termux

Android/Termux support is build-only, not full platform support. cargo install sabiql should compile on Android, but clipboard yank is unavailable because the desktop clipboard backend is not supported there. psql is still required.

Development

With Nix:

direnv allow
cargo nextest run --workspace
nix build

Without direnv, enter the shell explicitly:

nix develop

Roadmap

  • Connection management UI
  • ER diagram generation
  • Read-only mode (Ctrl+R)
  • SQL modal with DML/DDL safety guardrails
  • Query history persistence & fuzzy search
  • CSV export & clipboard yank
  • EXPLAIN workflow (plan tree view & comparison)
  • JSON/JSONB support (tree view, editing, validation)
  • Theme switching (Sabiql Dark / Light)
  • Neovim integration (sabiql.nvim)
  • SQLite support
  • Zero-config connection (env vars, .pgpass, URI auto-detect)
  • Google Cloud SQL / AlloyDB support
  • MySQL support

Have a feature request? Open an issue feedback is welcome!

License

MIT — see LICENSE.

About

A fast PostgreSQL TUI written in Rust — driver-less, vim-first, with ER diagrams. No database drivers, no setup, just psql

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors

Languages