Updated Sep 29, 20264 min read
Introducing sqmeow.nvim
A Rust-powered database client for Neovim with persistent scratchpads, paged results, in-grid editing, and support for SQL and NoSQL databases.
sqmeow.nvim is a database client that lives inside Neovim. You browse schemas, write queries, and read, filter, and edit results without leaving the editor. A separate Rust process runs the queries and returns paged results.
It takes ideas from vim-dadbod, vim-dadbod-ui, and nvim-dbee, then adds a few things I missed. Here are the highlights.
#A Rust engine that never blocks the editor
Queries run in a separate Rust process, not in Neovim. Results come back one page at a time, so a query that returns 100,000 rows doesn't freeze your editor. Press <C-c> to cancel a slow query.
#One workflow across SQL and NoSQL
The same drawer, scratchpad, and result window work across SQL and NoSQL databases:
| Database | Query language |
|---|---|
| PostgreSQL, CockroachDB | SQL |
| MySQL, MariaDB | SQL |
| SQLite | SQL |
| DuckDB | SQL |
| ClickHouse | SQL (read-only) |
| Redis, Valkey, Dragonfly | Redis commands |
| MongoDB | Extended JSON |
| ScyllaDB, Cassandra | CQL |
| SurrealDB | SurrealQL |
| Oracle Database | SQL |
| Microsoft SQL Server | SQL |
#Persistent scratchpads and multiple connections
Keep several databases open at once and save query buffers as scratchpads. Press u on a connection to make it active, or use :Sqmeow bind to tie a buffer to a specific connection. Run the statement under the cursor, a visual selection, or the whole buffer. EXPLAIN output and query errors appear in the result window.
A project can declare its databases in .sqmeow/connections.toml, one section per connection, so the setup travels with the repo. SQMEOW_CONNECTIONS covers the environment-variable case.
Scratchpads complete schema, table, and column names through blink.cmp or nvim-cmp. Install the sql Treesitter parser for query-aware column suggestions in WHERE, GROUP BY, and ORDER BY.
#A schema drawer
Browse schemas, tables, views, routines, and columns, with their types and keys. Press p on a table to preview its first page, K to see its structure, or s to yank a ready-made SELECT.
#Edit results in place
Change a cell, add a row, or delete rows directly in the grid. Nothing touches the database until you review the staged changes with gs (or <C-s>) and press <C-s> again in the review window to apply them.
Editing requires a plain table column and that table's complete primary or unique key in the result. Joined results can update each table through its own key; new rows require a single-table result.
#Filter and sort results
Press gf for a WHERE bar or go for an ORDER BY bar, or = to filter by the value under the cursor. SQL filters rerun the query on the database, and MongoDB accepts filter and sort documents. Redis, ScyllaDB, SurrealDB, and closed connections filter cached results in memory instead.
#A query log and exports
Results can be saved to a query log that survives restarts. :Sqmeow log reopens them. Press x to export a result, or selected rows, to CSV, JSON, or SQL INSERT statements, into a file or the clipboard. SQL exports support single or batched inserts and an optional CREATE TABLE statement.
#Safe by default
- Confirmations. sqmeow asks before a
DELETEorUPDATEwithoutWHERE, aDROP, or aTRUNCATE. - Read-only connections. Tick Read only when adding a connection. PostgreSQL, MySQL, ClickHouse, SQLite, and DuckDB enforce it in the database session. Redis, MongoDB, ScyllaDB, SurrealDB, and OracleDB check statements instead, so use a read-only database account when access control matters.
- No passwords in dotfiles. URLs can read secrets with
{{ env "VAR" }},{{ exec "cmd" }}, or{{ file "path" }}, and passwords are masked wherever a URL is shown. - SSH tunnels. Reach a database behind a bastion with your own
sshsetup.
#Try it
Install it with lazy.nvim:
return {
"2giosangmitom/sqmeow.nvim",
dependencies = { "MunifTanjim/nui.nvim" },
version = "*",
build = function()
require("sqmeow").install()
end,
opts = {},
cmd = "Sqmeow",
}
Then run :Sqmeow. The README also covers mini.deps and vim.pack setups. For a full setup with keymaps, connections, and SQL linting, read How I use Neovim as a database client.