Introducing clutch — an interactive database client for Emacs.

MySQL, PostgreSQL, and SQLite via pure Elisp (no external CLI). Oracle, SQL Server, DB2, Snowflake, and Redshift via a lightweight JVM sidecar (clutch-jdbc-agent, Java 17+).

https://github.com/LuciusChen/clutch

#Emacs #SQL #Database

The MySQL and PostgreSQL backends are pure Elisp — no libpq, no mysql CLI, no FFI.

MySQL: full wire protocol, caching_sha2_password + native_password auth, TLS via GnuTLS, prepared statements, binary protocol.

PostgreSQL: wire protocol v3, SCRAM-SHA-256 + MD5, TLS, OID-based type parsing (json/jsonb, bytea, numerics, dates…).

The result browser is column-paged — no horizontal scrolling. Columns that don't fit get a ◂▸ indicator and you page through them with [ and ].

Fixed header row, row numbers, right-aligned numerics, sort indicators, and a tab-line showing row count, page, elapsed time, staged-change summary, and active filters.

Results aren't read-only. You can:

• Edit a cell → staged UPDATE
• Press o → staged INSERT row
• Press d → staged DELETE row
• C-c C-p to preview the exact SQL before anything runs
• C-c C-c to execute INSERT → UPDATE → DELETE in order, with a confirmation prompt showing every statement

Tab-completion for table and column names, scoped to the current SQL statement. Eldoc shows type, nullability, PK/FK references, and comments for the symbol at point — no hover required.

Schema browser (C-c C-t) with expandable column details. Schema state is surfaced everywhere: buffer name shows [schema 42t], header-line warns on stale/failed.

For Oracle and other enterprise databases, clutch spawns a small JVM sidecar (clutch-jdbc-agent). The jar is auto-downloaded on first use; JDBC drivers go in ~/.emacs.d/clutch-jdbc/drivers/.

Oracle defaults to manual-commit mode (matching DataGrip). C-c C-m commits, C-c C-u rolls back. The header-line shows Tx: Manual* when you have uncommitted DML.

The console header-line shows your connection at a glance: brand-colored DB icon + backend name + connection key + schema/tx state. Indented to align with the text area.

Icons: MySQL in #469AD7, PostgreSQL in #336791, Oracle (α) in #C74634, Snowflake in #29B5E8… powered by nerd-icons with Unicode fallback.

A few more things:

• Value viewer (v): JSON pretty-printed with json-ts-mode, XML via xmllint/nxml-mode, BLOB as hex preview
• Org-Babel integration (ob-clutch) for literate SQL notebooks
• REPL mode (comint-based) for interactive sessions
• auth-source / pass integration for passwords
• Auto-reconnect on dropped connections