Search
Query databases in Neovim (DBUI)
- backend: tpope/vim-dadbod: Modern database interface for Vim
- UI: kristijanhusak/vim-dadbod-ui: Simple UI for above backend
# Features
# Supported DBs
As of 2025-02-23, supports a modern array of backends, including NoSQL databases:
- Big Query
- ClickHouse: clickhouse://[<host>[:port]]/[<database>]
- Details see
- DuckDB: duckdb:/Users/sspaeti/Documents/duckdbs/playground-v1-1-1.duckdb
- Impala
- jq
- MongoDB
- MySQL
- MariaDB
- Oracle
- osquery
- PostgreSQL: postgresql:///foobar
- Presto
- Redis
- Snowflake
- SQL Server
- SQLite: sqlite:myfile.sqlite3 select count(*) from widgets
- Your own easily implemented adapter
- Easily configurable based on a project directory (as seen in rails.vim, for example), rather than just globally or in a per-file modeline
- For those that just can’t live without some piece of dbext functionality, the option
g:dadbod_manage_dbextis provided to force dbext to use Dadbod’s default database.
# Connect Databases
# DuckDB
|
|
My configs in database.lua:
|
|
# ClickHouse and encode password
If passwords contain speecial characters such as @ you need to encode it for it to work.
Connection string format:
clickhouse://user:password@host/database?secure
Example - for specific database
clickhouse://default:mypass@myhost.us-east-1.aws.clickhouse.cloud/staging?secure
Example - for all databases
clickhouse://default:mypass@myhost.us-east-1.aws.clickhouse.cloud?secure
?secureis required for ClickHouse Cloud (maps to--secureon the CLI)- Requires
clickhouse-client(orclickhouse client) installed locally - If passwords contain special characters like
@, you need to URL-encode them:
| Character | Encoded |
|---|---|
@ |
%40 |
# |
%23 |
? |
%3F |
/ |
%2F |
% |
%25 |
Quick way to get the encoded password:
|
|
# Setup
# Alternatives
- nvim-dbee: Interactive database client for neovim
- Use Neovim features only with exporting database into a variable and run the cli for the data base such as psql and return to vim. Great example by Henry Misc here: Run SQL in Vim Without Plugins.
# Futher Reads
Origin:
References: SQL IDEs