Skip to main content

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.

CI PyPI Documentation License: MIT

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 revenue and 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-c for 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.

Dockerdbcrust 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

dbcrust-0.30.0-cp310-abi3-win_amd64.whl (14.2 MB view details)

Uploaded CPython 3.10+Windows x86-64

dbcrust-0.30.0-cp310-abi3-musllinux_1_2_x86_64.whl (18.4 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

dbcrust-0.30.0-cp310-abi3-musllinux_1_2_aarch64.whl (18.3 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

dbcrust-0.30.0-cp310-abi3-manylinux_2_28_aarch64.whl (18.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

dbcrust-0.30.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.6 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

dbcrust-0.30.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (18.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ i686

dbcrust-0.30.0-cp310-abi3-macosx_11_0_arm64.whl (14.8 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

dbcrust-0.30.0-cp310-abi3-macosx_10_12_x86_64.whl (14.6 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file dbcrust-0.30.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: dbcrust-0.30.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

Hashes for dbcrust-0.30.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 85e7da22fcde76b182ccf16dc6db2ca15504288ed71a978009560743b4b2a76b
MD5 bfd09efee94a89a5ee4931230d29b425
BLAKE2b-256 ee8a00c0550229aab5547c913bf1e3c2e9e25de603bfbb775d7f62a6f0477a62

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbcrust-0.30.0-cp310-abi3-win_amd64.whl:

Publisher: release.yml on clement-tourriere/dbcrust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbcrust-0.30.0-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for dbcrust-0.30.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0ea0fb4ebbcada060943b08aa6844f31dd3b0a8f9a7f84afbe4d232bd7d7a6fa
MD5 de0a0ef734c6df55f8f36ce0b6c4b81c
BLAKE2b-256 cb65e06b164bcc141d2cec1f7344fae6c8bc2515986628bee967ffa62da3145c

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbcrust-0.30.0-cp310-abi3-musllinux_1_2_x86_64.whl:

Publisher: release.yml on clement-tourriere/dbcrust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbcrust-0.30.0-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for dbcrust-0.30.0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 2066d71ad34e84f590ebadd67573f62adb38b12d25f4d602fefea72224675426
MD5 f0cbce8f3dd5b912d32c28040a431e40
BLAKE2b-256 81dedc0e193d39128862249e60f9cbb6adc28c3d92d9f8b3525dff9ffcbfec3a

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbcrust-0.30.0-cp310-abi3-musllinux_1_2_aarch64.whl:

Publisher: release.yml on clement-tourriere/dbcrust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbcrust-0.30.0-cp310-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for dbcrust-0.30.0-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9910370009ccf9fa8f219bf14957d660845d02c74f2f76916e645139d8e969f6
MD5 3dbbcb61c050f177ef66c912a8b25835
BLAKE2b-256 a6d8ebf28f99794d4f75232cb61d18bb30c44b9d1aa57ace7249e67f8dbcf754

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbcrust-0.30.0-cp310-abi3-manylinux_2_28_aarch64.whl:

Publisher: release.yml on clement-tourriere/dbcrust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbcrust-0.30.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dbcrust-0.30.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 929aaeb90281660221f039c54e3676fd6e9505a48bd75cdadce7d18c2672ed83
MD5 c84a9830eeede21e661fefc627cdb4f3
BLAKE2b-256 b18c8f932347282993f8d237e6e1a3f38a11f6a76598ffe2ded73ef26fc98c3f

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbcrust-0.30.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on clement-tourriere/dbcrust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbcrust-0.30.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for dbcrust-0.30.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 b9f9250dadbaa643337f40661d8dd9847a76756ab27d2b4e39e8b15f9fb38221
MD5 1cb49312431137fcc2aa2ea536190060
BLAKE2b-256 1f823a3c5bf331dccd9b633e6e3cfc3960bc86301f0d14481d43244ac762b464

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbcrust-0.30.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: release.yml on clement-tourriere/dbcrust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbcrust-0.30.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dbcrust-0.30.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2553954f4e126a774e1ca80f2ba707dfaff6fd681b4794e4a0f1e2594f93c5b9
MD5 d847b6e07f8acf4e5900b468bcf62588
BLAKE2b-256 8f110484ddbbb216d68e9274d4dc817742f877e8b1e7a0f1fc3e006464a69c0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbcrust-0.30.0-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on clement-tourriere/dbcrust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbcrust-0.30.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for dbcrust-0.30.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0bf7b5a82a7cc9762c475bab954fac9ec14c948693805cd124f3167d1653732c
MD5 1b755647037a9a21ae367182ba39b993
BLAKE2b-256 04e22b1baacdb5e85c8eeee2f9667484d37a9c4d74d0cce1eb762d7c7feb68b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbcrust-0.30.0-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on clement-tourriere/dbcrust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page