High-performance database CLI engineered for Django developers — Advanced ORM analysis, performance optimization, SSH tunneling, and seamless multi-database support (PostgreSQL, MySQL, SQLite)
Project description
DBCrust
One fast client for every database. PostgreSQL, MySQL, SQLite, ClickHouse, MongoDB, Elasticsearch — and SQL over Parquet, CSV, and JSON files. Built in Rust, with an AI assistant, smart autocompletion, SSH tunneling, Vault integration, and a desktop GUI.
curl -fsSL https://clement-tourriere.github.io/dbcrust/install.sh | sh
dbcrust postgres://user:pass@localhost/mydb
Documentation · Quick start · Command reference · Python API
Why DBCrust
- Every database, one tool — the same REPL, commands, and muscle memory across PostgreSQL, MySQL, SQLite, ClickHouse, MongoDB, and Elasticsearch.
- AI assistant built in — type
?? top 10 customers by revenueand get SQL generated from your actual schema, shown before it runs. Works with Anthropic, OpenAI, Gemini, Ollama, and 20+ other providers. - Files are databases too — run SQL directly on Parquet, CSV, and JSON via Apache DataFusion.
- Production-friendly plumbing — SSH tunnels (with auto-tunnel patterns), HashiCorp Vault dynamic credentials, Docker container auto-discovery, encrypted password storage.
- A REPL that helps — context-aware autocompletion, syntax highlighting, history search, external editor, EXPLAIN visualization (including an interactive TUI), named queries, saved sessions.
- Scriptable and embeddable —
-cfor one-shot queries, a Python API powered by the same Rust core, and a Django ORM performance analyzer.
Install
# Pre-built binary — macOS & Linux
curl -fsSL https://clement-tourriere.github.io/dbcrust/install.sh | sh
# Pre-built binary — Windows (PowerShell)
irm https://clement-tourriere.github.io/dbcrust/install.ps1 | iex
# Python 3.10+ (ships the same native binary)
uv tool install dbcrust # or: pipx install dbcrust / pip install dbcrust
uvx dbcrust <url> # run without installing
# From source (Rust 1.85+)
cargo install --path .
Two binaries are installed: dbcrust and the short alias dbc.
dbcrust --update # self-update (detects uv / pipx / pip / cargo / binary installs)
dbcrust --completions zsh # shell completions (bash, zsh, fish, powershell, ...)
Quick start
dbcrust postgres://user:pass@localhost/mydb # interactive session
dbcrust recent:// # pick from recent connections
dbcrust sqlite:///path/to/db.sqlite -c "SELECT count(*) FROM users" # run and exit
Every connection type is a URL:
| Scheme | Example |
|---|---|
| PostgreSQL | postgres://user:pass@localhost:5432/mydb?sslmode=require |
| MySQL | mysql://root:pass@localhost:3306/mydb |
| SQLite | sqlite:///path/to/db.sqlite |
| ClickHouse | clickhouse://user:pass@localhost:8123/default |
| MongoDB | mongodb://user:pass@localhost:27017/mydb |
| Elasticsearch | elasticsearch://localhost:9200 |
| Parquet / CSV / JSON | parquet:///data/*.parquet · csv:///logs/app.csv?header=true · json:///events.json |
| Docker container | docker:// (interactive picker) · docker://my-postgres/mydb |
| Saved session | session://production_db |
| Recent connections | recent:// |
| Vault credentials | vault://readonly@database/postgres-prod |
Full details: URL schemes reference.
The interactive session
Connecting drops you into a REPL with context-aware SQL autocompletion, syntax highlighting, searchable history, and 60+ psql-style backslash commands. The most used:
| Commands | |
|---|---|
| Explore | \l databases · \c <db> switch · \dt tables · \d <table> describe |
| Display | \x expanded · \cs column selection · \e EXPLAIN mode · \ev interactive EXPLAIN TUI |
| Edit & run | \ed open $EDITOR · \i <file> run SQL file · \w <file> write last query |
| Named queries | \n list · \ns <name> <sql> save · \nd <name> delete |
| Connections | \ss <name> save session · \s list sessions · \r recent · \docker containers |
| Credentials | \savepass store password · \vc Vault cache status |
| Meta | \ai AI assistant · \config settings editor · \h help · \q quit |
Named queries support positional parameters ($1, $*, $@) and scopes — global, per-database-type, or session-local.
See the full command reference.
AI assistant
Turn natural language into SQL without leaving your session. The assistant uses your database's real schema as context, streams its answer, and always shows the SQL before running it (writes default to "No").
\ai setup -- one-time wizard: provider, model, API key
?? top 10 customers by total order value this year
?? now only the active ones -- follow-ups keep conversation context
- Providers: Anthropic, OpenAI, Gemini, Ollama, Groq, DeepSeek, xAI, OpenRouter, and more — 25+ via genai, including any OpenAI-compatible endpoint for self-hosted models.
- Private by design: disabled by default; only schema metadata and your question are sent — never row data. API keys live in your OS keychain, an encrypted file, or environment variables.
More in the AI assistant guide.
Tunnels, Vault & Docker
SSH tunneling — reach databases behind a jump host, explicitly or automatically via config patterns:
dbcrust postgres://user@db.internal/app --ssh-tunnel jumphost.example.com
# ~/.config/dbcrust/config.toml — auto-tunnel any host matching the pattern
[ssh_tunnel_patterns]
"^db\\.internal\\..*\\.com$" = "user@jumphost.example.com:2222"
HashiCorp Vault — dynamic database credentials with an encrypted local cache: dbcrust vault://readonly@database/postgres-prod.
Docker — dbcrust docker:// lists running database containers and connects without you hunting for ports or credentials.
Python & Django
The Python package wraps the same Rust core via PyO3 — identical URLs, commands, and behavior.
import dbcrust
dbcrust.run_command("postgres://user:pass@localhost/mydb", "SELECT * FROM users LIMIT 5")
dbcrust.run_cli("postgres://user:pass@localhost/mydb") # full interactive REPL
from dbcrust import PostgresClient
client = PostgresClient(host="localhost", user="postgres", dbname="myapp")
tables = client.list_tables()
The Django integration detects N+1 queries and other ORM performance issues:
# settings.py
MIDDLEWARE = ["dbcrust.django.PerformanceAnalysisMiddleware", ...]
# or analyze a block of code explicitly
from dbcrust.django import analyzer
with analyzer.analyze() as analysis:
for book in Book.objects.all():
print(book.author.name) # N+1 detected
results = analysis.get_results()
python manage.py dbcrust # connect using your Django DB settings
Guides: Python API · Django analyzer.
Desktop GUI
A Tauri-based desktop app ships in the repo (built from source for now): CodeMirror SQL editor, schema explorer, visual EXPLAIN viewer, Docker discovery, multi-tab queries, and a system tray. See the GUI guide.
mise install && mise run gui:install
mise run gui:dev # development (hot-reload)
mise run gui:build # production .app / .dmg / .msi
Configuration
Settings live in ~/.config/dbcrust/, with user data kept in dedicated files:
| File | Contents |
|---|---|
config.toml |
App settings (display, limits, SSH patterns, AI, logging, ...) |
sessions.toml |
Saved sessions |
recent.toml |
Recent connections |
named_queries.toml |
Named queries |
vault_credentials.enc |
Encrypted Vault credential cache |
~/.dbcrust |
Stored passwords (pgpass-style) |
Edit configuration interactively or from scripts — no connection required:
dbcrust config # interactive menu (also \config inside the REPL)
dbcrust config get logging.level
dbcrust config set logging.level debug
dbcrust config edit # open config.toml in $EDITOR
Full list of options: configuration reference.
Development
DBCrust uses mise for toolchain and task management — mise install sets up everything (Bun for the GUI, commitizen, etc.).
mise run build:dev # debug build mise run build # release build
mise run test # cargo test mise run check # fmt + lint + test
mise run py:dev # maturin develop mise run py:test # Python tests
mise run gui:dev # GUI with hot-reload mise run docs # docs dev server
src/ Rust core — CLI, REPL, database backends, AI assistant
├── commands.rs backslash command system (enum + strum)
├── database_*.rs per-database implementations
└── explain_tui/ interactive EXPLAIN visualizer (ratatui)
gui/ Tauri desktop app (React + TypeScript, Bun)
python/ Python bindings (PyO3 + maturin) and Django integration
docs/ documentation site (Astro Starlight)
More in the development guide.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dbcrust-0.29.0-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: dbcrust-0.29.0-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 14.2 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71fc4d4f5e8e31dd400dff8784cc185bbee1aacd050b6eb9b448b20b7d82c0bb
|
|
| MD5 |
99a04e3f586a5fc076badb472aa4c350
|
|
| BLAKE2b-256 |
e4a89add815a2eac8ec5c331d40ee3ab9b4309ee320fa99e72f6cc5d9defbd5c
|
Provenance
The following attestation bundles were made for dbcrust-0.29.0-cp310-abi3-win_amd64.whl:
Publisher:
release.yml on clement-tourriere/dbcrust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbcrust-0.29.0-cp310-abi3-win_amd64.whl -
Subject digest:
71fc4d4f5e8e31dd400dff8784cc185bbee1aacd050b6eb9b448b20b7d82c0bb - Sigstore transparency entry: 1803174683
- Sigstore integration time:
-
Permalink:
clement-tourriere/dbcrust@9ea197c540d9d5658b352e8fa34554308ff6d468 -
Branch / Tag:
refs/tags/v0.29.0 - Owner: https://github.com/clement-tourriere
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9ea197c540d9d5658b352e8fa34554308ff6d468 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dbcrust-0.29.0-cp310-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: dbcrust-0.29.0-cp310-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 18.3 MB
- Tags: CPython 3.10+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e73f2d6f958f34aab685d38867e4d33875515a762a09cbbc73581c71b6d346ca
|
|
| MD5 |
b6ee95987b44a884676e649c00e9e48e
|
|
| BLAKE2b-256 |
6d3bf942af3b09bce8faf5def349d2199ddb38001226461172f93b43b5656f82
|
Provenance
The following attestation bundles were made for dbcrust-0.29.0-cp310-abi3-musllinux_1_2_x86_64.whl:
Publisher:
release.yml on clement-tourriere/dbcrust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbcrust-0.29.0-cp310-abi3-musllinux_1_2_x86_64.whl -
Subject digest:
e73f2d6f958f34aab685d38867e4d33875515a762a09cbbc73581c71b6d346ca - Sigstore transparency entry: 1803174836
- Sigstore integration time:
-
Permalink:
clement-tourriere/dbcrust@9ea197c540d9d5658b352e8fa34554308ff6d468 -
Branch / Tag:
refs/tags/v0.29.0 - Owner: https://github.com/clement-tourriere
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9ea197c540d9d5658b352e8fa34554308ff6d468 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dbcrust-0.29.0-cp310-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: dbcrust-0.29.0-cp310-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 18.3 MB
- Tags: CPython 3.10+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86e799bfb7979eb725b134a713d204c21769347fe80692b44008747cceb2e16b
|
|
| MD5 |
932fee7b98a88fa507944c475ccd3c00
|
|
| BLAKE2b-256 |
3081839911bd7ef0d19f8b6adfd5bcf78248a0057478467e17e0bcd234cef2ec
|
Provenance
The following attestation bundles were made for dbcrust-0.29.0-cp310-abi3-musllinux_1_2_aarch64.whl:
Publisher:
release.yml on clement-tourriere/dbcrust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbcrust-0.29.0-cp310-abi3-musllinux_1_2_aarch64.whl -
Subject digest:
86e799bfb7979eb725b134a713d204c21769347fe80692b44008747cceb2e16b - Sigstore transparency entry: 1803174743
- Sigstore integration time:
-
Permalink:
clement-tourriere/dbcrust@9ea197c540d9d5658b352e8fa34554308ff6d468 -
Branch / Tag:
refs/tags/v0.29.0 - Owner: https://github.com/clement-tourriere
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9ea197c540d9d5658b352e8fa34554308ff6d468 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dbcrust-0.29.0-cp310-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: dbcrust-0.29.0-cp310-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 18.0 MB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6de25397932a469a14731817af7744abf1579981d69b1cfa3844757401ef5d45
|
|
| MD5 |
7be7f9a35fed8c30836bb837e0ca15ca
|
|
| BLAKE2b-256 |
bdf6a209e72dedf61c93b3056813c24a8b4703409d49aadd168ef09962f26ba4
|
Provenance
The following attestation bundles were made for dbcrust-0.29.0-cp310-abi3-manylinux_2_28_aarch64.whl:
Publisher:
release.yml on clement-tourriere/dbcrust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbcrust-0.29.0-cp310-abi3-manylinux_2_28_aarch64.whl -
Subject digest:
6de25397932a469a14731817af7744abf1579981d69b1cfa3844757401ef5d45 - Sigstore transparency entry: 1803174611
- Sigstore integration time:
-
Permalink:
clement-tourriere/dbcrust@9ea197c540d9d5658b352e8fa34554308ff6d468 -
Branch / Tag:
refs/tags/v0.29.0 - Owner: https://github.com/clement-tourriere
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9ea197c540d9d5658b352e8fa34554308ff6d468 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dbcrust-0.29.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: dbcrust-0.29.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 17.5 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0502871a9e007d606880e6e5f180721f98073f90e3a73302f13f066ef2199f4a
|
|
| MD5 |
8d56939495618ad2eff3456b7c1cb50e
|
|
| BLAKE2b-256 |
0ffa466785a2ee9dc6a16bd1f7873e2df3650b7329aabf666d9eba31f1124f68
|
Provenance
The following attestation bundles were made for dbcrust-0.29.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on clement-tourriere/dbcrust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbcrust-0.29.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
0502871a9e007d606880e6e5f180721f98073f90e3a73302f13f066ef2199f4a - Sigstore transparency entry: 1803174984
- Sigstore integration time:
-
Permalink:
clement-tourriere/dbcrust@9ea197c540d9d5658b352e8fa34554308ff6d468 -
Branch / Tag:
refs/tags/v0.29.0 - Owner: https://github.com/clement-tourriere
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9ea197c540d9d5658b352e8fa34554308ff6d468 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dbcrust-0.29.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.
File metadata
- Download URL: dbcrust-0.29.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 18.0 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18e645a28c969f765a13963d5f7db081538b5d886c02551dbd7ba0eaf9e23e60
|
|
| MD5 |
2044b1063812acf31c9d9083696f6593
|
|
| BLAKE2b-256 |
0f5ec625b5f0e9e4913572445a5d5629b8d6ab6963a47f86c5a23a5dfcbb456a
|
Provenance
The following attestation bundles were made for dbcrust-0.29.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl:
Publisher:
release.yml on clement-tourriere/dbcrust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbcrust-0.29.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl -
Subject digest:
18e645a28c969f765a13963d5f7db081538b5d886c02551dbd7ba0eaf9e23e60 - Sigstore transparency entry: 1803174927
- Sigstore integration time:
-
Permalink:
clement-tourriere/dbcrust@9ea197c540d9d5658b352e8fa34554308ff6d468 -
Branch / Tag:
refs/tags/v0.29.0 - Owner: https://github.com/clement-tourriere
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9ea197c540d9d5658b352e8fa34554308ff6d468 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dbcrust-0.29.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: dbcrust-0.29.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 14.8 MB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
212704b547da66aa988dc6e9c47afe23229fc076ca63ab07d524fdda8df27238
|
|
| MD5 |
ee3459d34867365a6685148f4d6bb12b
|
|
| BLAKE2b-256 |
402e201ca7c5ba3c26abd29b84ba2557131a97f5ae091b2262b315cafe6ddfec
|
Provenance
The following attestation bundles were made for dbcrust-0.29.0-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on clement-tourriere/dbcrust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbcrust-0.29.0-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
212704b547da66aa988dc6e9c47afe23229fc076ca63ab07d524fdda8df27238 - Sigstore transparency entry: 1803175126
- Sigstore integration time:
-
Permalink:
clement-tourriere/dbcrust@9ea197c540d9d5658b352e8fa34554308ff6d468 -
Branch / Tag:
refs/tags/v0.29.0 - Owner: https://github.com/clement-tourriere
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9ea197c540d9d5658b352e8fa34554308ff6d468 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dbcrust-0.29.0-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: dbcrust-0.29.0-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 14.5 MB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b815c8290deac3e81ee45c8d18b6e0679fed1cd15a637ee382014bd13f718553
|
|
| MD5 |
42bc0b148538b193f9215f8f294712c1
|
|
| BLAKE2b-256 |
2c6a196d131bbab2f6a1e8e26e878f6ee108f2c4eed41f4e36da34941bceeef5
|
Provenance
The following attestation bundles were made for dbcrust-0.29.0-cp310-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on clement-tourriere/dbcrust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbcrust-0.29.0-cp310-abi3-macosx_10_12_x86_64.whl -
Subject digest:
b815c8290deac3e81ee45c8d18b6e0679fed1cd15a637ee382014bd13f718553 - Sigstore transparency entry: 1803175058
- Sigstore integration time:
-
Permalink:
clement-tourriere/dbcrust@9ea197c540d9d5658b352e8fa34554308ff6d468 -
Branch / Tag:
refs/tags/v0.29.0 - Owner: https://github.com/clement-tourriere
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9ea197c540d9d5658b352e8fa34554308ff6d468 -
Trigger Event:
push
-
Statement type: