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
.dbfiles 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)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| db_mate-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for db_mate-1.0.0-py3-none-any.whl |
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
|
Security for db-mate 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.