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.2.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.2-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kerndb-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 daec73b13976b3acfd56b129fdf30986a6573c59388410cbd820cb26ebaa17e1
MD5 4ad44351d5dd73e7415c958cd87c8afd
BLAKE2b-256 02f0414c2da9e4655d8050f792bacaeeecadfed1f2d3a6ec4ea7ee13a9951c7c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kerndb-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cd0fe7d4d1567120dadc8d07e1032a986c21833f4b5339a147af9e2e617326db
MD5 b7e60345ee07beb997ac19a6216430a2
BLAKE2b-256 0d98eb9f3905ca38dc88fac4d13678f918a19e8afe09b7491c9d4e92b4b0e23f

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