Skip to main content

db-mate

A zero-dependency SQLite database CLI manager with color-coded output and an interactive TUI browser.

Features

  • List tables — view all tables with column names, types, and nullability
  • Schema visualization — ASCII box-drawing of table schemas with DDL
  • Query execution — run arbitrary SQL with nicely formatted table output
  • Export — dump tables to CSV or JSON
  • Import — load CSV files into tables
  • Statistics — database file size, row counts, column type breakdowns, indexes
  • TUI mode — curses-based interactive browser for tables and data
  • Zero external dependencies — uses only Python stdlib (sqlite3, csv, json, curses)
  • Auto-detect — finds .db files in the current directory

Installation

cd /root/evolver-packages/db-mate
pip install -e .

Usage

CLI Mode

# List all tables in a database
db-mate list

# Show schema as ASCII diagram
db-mate schema

# Show tables with row counts
db-mate tables

# Run a SQL query
db-mate query "SELECT name, COUNT(*) FROM users GROUP BY name"

# Export a table
db-mate export users csv
db-mate export users json

# Import a CSV into a table
db-mate import users data.csv

# Show database statistics
db-mate stats

# Specify a database explicitly
db-mate --db mydata.db list
db-mate --db mydata.db query "SELECT * FROM users"

TUI Mode

# Launch the interactive curses-based browser
db-mate --tui

# With a specific database
db-mate --db mydata.db --tui

TUI Key Bindings

Key Action
t Tables overview
b Browse table data
s SQL query mode
n / p Next / previous table
j / k Scroll down / up
← / → Scroll columns (browse mode)
Enter Execute SQL query
q Quit

Examples

# Create a test database and explore it
$ sqlite3 test.db "CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, email TEXT);"
$ sqlite3 test.db "INSERT INTO users VALUES (1, 'Alice', 'alice@example.com'), (2, 'Bob', 'bob@example.com');"

$ db-mate --db test.db list
$ db-mate --db test.db schema
$ db-mate --db test.db stats
$ db-mate --db test.db query "SELECT * FROM users"

Project Structure

db-mate/
├── pyproject.toml
├── README.md
└── src/
    └── db_mate/
        ├── __init__.py
        ├── __main__.py
        ├── cli.py
        └── tui.py

License

MIT

Metadata

Release files for db-mate 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for db-mate 1.0.0
File Interpreter ABI Platform
db_mate-1.0.0-py3-none-any.whl Python 3 none any Details

Release files / db_mate-1.0.0-py3-none-any.whl

Download URL db_mate-1.0.0-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c42fc94fed2a01f043590258ec0363ac30391929f0ab56fdb9b25ba6a8083f63
BLAKE2b-256 checksum
How to use checksums
95534681afab41832cdca040038c08a7695aaaae1b71644e18b5812425f0f626
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page