Skip to main content

A minimal, UI-first terminal database client

Project description

kerndb

A minimal, UI-first terminal database client. Connect, explore, and query your PostgreSQL database without leaving the terminal.

Python PyPI License

kerndb homescreen


Installation

Recommended — pipx (no venv needed)

pipx install kerndb

Alternative — pip

pip install kerndb

Verify

kerndb --version

Why pipx? pipx installs CLI tools in isolated environments automatically. You get the kerndb command globally without managing a virtual environment yourself. Install pipx with pip install pipx or brew install pipx.


Quick Start

kerndb

That's it. The UI opens. Add a connection and start querying.


What is kerndb?

kerndb is a terminal-based database client with a full interactive UI that runs inside your terminal. Built for developers who want the speed of the terminal without sacrificing the visual clarity of a GUI tool like TablePlus or DBeaver.

The terminal is not a limitation. It is a canvas.


Using the TUI

Adding a connection

Launch kerndb and press N to add a new connection. Fill in your PostgreSQL details and press Save. Passwords are never stored on disk — kerndb reads them from environment variables:

# set password for a connection named "mydb"
# Windows
$env:KERNDB_PASSWORD_MYDB="yourpassword"

# Mac/Linux
export KERNDB_PASSWORD_MYDB=yourpassword

Or use a .env file in your project directory:

KERNDB_PASSWORD_MYDB=yourpassword

Running queries

  • Click any table in the sidebar to preview its data
  • Write SQL in the query editor and press F5 to run
  • Select part of your SQL and press F5 to run just the selection
  • Write multiple statements separated by ; and press F5 to run all

Keyboard shortcuts

Key Action
F5 Run query (or selected text)
N New connection (from picker screen)
D Delete connection (press twice to confirm)
Ctrl+B Go back to connection picker
Q Quit
Ctrl+C Force quit

CLI Commands

For scripting and automation — bypasses the TUI entirely.

# list saved connections
kerndb cli connections

# run a query
kerndb cli query "SELECT * FROM users LIMIT 10" --connection mydb

# export to CSV
kerndb cli query "SELECT * FROM orders" --export orders.csv --connection mydb

# save a connection
kerndb cli save mydb --user postgres --database mydb

# remove a connection
kerndb cli remove mydb

# update kerndb
kerndb cli update

Supported Databases

Database Status
PostgreSQL 12+ ✅ v1.0
MySQL 8+ 🔜 v2.0
SQLite 3+ 🔜 v2.0
MariaDB 🔜 planned
Supabase 🔜 planned
MongoDB 🔜 planned

Configuration

Connections are stored at ~/.kerndb/config.json. Passwords are never stored — use environment variables or a .env file.

{
  "connections": {
    "mydb": {
      "type": "postgres",
      "host": "localhost",
      "port": 5432,
      "user": "postgres",
      "database": "mydb"
    }
  }
}

Known Limitations

  • Template strings in INSERT/UPDATE queries (e.g. INSERT INTO users VALUES ('{{name}}')) are not supported in v1.0. Planned for a future release.

Development

git clone https://github.com/sayantanghosh-in/kerndb.git
cd kerndb
python -m venv venv
source venv/bin/activate   # windows: venv\Scripts\activate
pip install -r requirements.txt
pip install -e .
kerndb

Run tests:

python -m pytest tests/ -v

Contributing

Issues and PRs are welcome at github.com/sayantanghosh-in/kerndb.

Please make sure your code passes flake8 src/ and black src/ before submitting a PR.


License

MIT — see LICENSE for details.


Built by Sayantan Ghosh

Project details


Download files

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

Source Distribution

kerndb-0.1.1.tar.gz (44.3 kB view details)

Uploaded Source

Built Distribution

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

kerndb-0.1.1-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file kerndb-0.1.1.tar.gz.

File metadata

  • Download URL: kerndb-0.1.1.tar.gz
  • Upload date:
  • Size: 44.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.4

File hashes

Hashes for kerndb-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3631f4f03cf901757b700aab94b38a75c8a28e5722c0ee320ff6ce2d5fbfbfd2
MD5 0c1bf50526d299364d86bf33a03fd1c3
BLAKE2b-256 c51206693b96e4923e9ccd499c59db3aa98d12c16d198c8fd26598c12752bb46

See more details on using hashes here.

File details

Details for the file kerndb-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: kerndb-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.4

File hashes

Hashes for kerndb-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef1d3b2c5b49ff439424fbb564cfe6eb43e0ccb573805159ee9c8b6222435145
MD5 b40ea87a3030d65e0f28403806128e7c
BLAKE2b-256 857eb8ebdf0821301b838a7693b152f42be4a2fdfc6051662ce83e0949445949

See more details on using hashes here.

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