The lazygit of SQL databases
Connect and query your database from your terminal in seconds.
pipx install db-client-tui
Connect
Supports all major databases: SQL Server, PostgreSQL, MySQL, SQLite, MariaDB, FirebirdSQL, Oracle, DuckDB, CockroachDB, ClickHouse, Snowflake, Supabase, CloudFlare D1, Turso, Athena, BigQuery, Spanner, RedShift, IBM Db2, SAP HANA, Teradata, Trino, Presto, Apache Flight SQL, Apache Impala, SurrealDB and osquery.
Query
Syntax highlighting. History. Vim-style keybindings.
Results
Load millions of rows. Inspect data, filter by content, fuzzy search.
Docker Discovery
Automatically finds running database containers. Press 'Enter' to connect, db-client-tui figures out the details for you.
Features
Connection manager: Save and switch connections without CLI args
Just run db-client-tui: No CLI config needed, pick a connection and go
Multi-database support: PostgreSQL, MySQL, SQLite, SQL Server, and 10+ more
Docker integration: Auto-detect running database containers
Cloud CLI integration: Easily browse and connect to your external databases through Azure, AWS and GCP CLI's
SSH tunnels: Connect to remote databases securely with password or key auth
Secure credentials: Passwords stored in your OS keyring
Vim-style editing: Modal editing for terminal purists
Query history: Searchable, per-connection history
Filter results: Fuzzy search through millions of rows
Context-aware help: Keybindings shown on screen
Browse databases: Tables, views, procedures, indexes, triggers, sequences
Autocomplete: Sophisticated SQL completion engine for tables, columns, and procedures
CLI mode: Execute SQL from the command line
Themes: Rose Pine, Tokyo Night, Nord, Gruvbox
Dependency wizard: Auto-install missing drivers
Motivation
Throughout my career, the undesputed truth was that heavy GUI's like SSMS was the only respectable way to access a database. It didn't matter that I wasn't a DBA, or that I didn't need complex performance graphs. I was expected to install a gigabyte-heavy behemoth that took ages to launch all for the mere purpose of running a few queries to update and view a couple of rows.
When I switched to Linux, I was suddenly unable to return to the devil I know, and I asked myself: how do I access my data now?
The popular answer was VS Code's SQL extension. But why should we developers launch a heavy Electron app designed for coding just to execute SQL?
I had recently grown fond of Terminal UI's for their speed and keybinding focus. I looked for SQL TUIs, but the options were sparse. The ones I found lacked the user-friendliness and immediate "pick-up-and-go" nature of tools I loved, like lazygit, and I shortly returning to vscode sql extension.
Something wasn't right. I asked myself, why is it that running SQL queries can't be enjoyable? So I created db-client-tui.
db-client-tui is for the developer who just wants to query their database with a user friendly UI without their RAM being eaten alive. It is a lightweight, beautiful, and keyboard-driven TUI designed to make accessing your data enjoyable, fast and easy like it should be-- all from inside your favorite terminal.
Installation
# pipx (recommended)
pipx install db-client-tui
# uv
uv tool install db-client-tui
# pip
pip install db-client-tui
# Arch Linux (AUR)
yay -S db-client-tui
# Nix (flake)
nix run github:sergey-today/db-client-tui
Usage
db-client-tui
The keybindings are shown at the bottom of the screen.
Try it without a database
Want to explore the UI without connecting to a real database? Run with mock data:
db-client-tui --mock=sqlite-demo
CLI
db-client-tui -c "MyConnection"
db-client-tui --connection "MyConnection"
# Run a query
db-client-tui query -c "MyConnection" -q "SELECT * FROM Users"
# Output as CSV or JSON
db-client-tui query -c "MyConnection" -q "SELECT * FROM Users" --format csv
db-client-tui query -c "MyConnection" -f "script.sql" --format json
# Create connections for different databases
db-client-tui connections add mssql --name "MySqlServer" --server "localhost" --auth-type sql
db-client-tui connections add postgresql --name "MyPostgres" --server "localhost" --username "user" --password "pass"
db-client-tui connections add mysql --name "MyMySQL" --server "localhost" --username "user" --password "pass"
db-client-tui connections add cockroachdb --name "MyCockroach" --server "localhost" --port "26257" --database "defaultdb" --username "root"
db-client-tui connections add sqlite --name "MyLocalDB" --file-path "/path/to/database.db"
db-client-tui connections add turso --name "MyTurso" --server "libsql://your-db.turso.io" --password "your-auth-token"
db-client-tui connections add firebird --name "MyFirebird" --server "localhost" --username "user" --password "pass" --database "employee"
db-client-tui connections add athena --name "MyAthena" --athena-region-name "us-east-1" --athena-s3-staging-dir "s3://my-bucket/results/" --athena-auth-method "profile" --athena-profile-name "default"
db-client-tui connections add athena --name "MyAthenaKeys" --athena-region-name "us-east-1" --athena-s3-staging-dir "s3://my-bucket/results/" --athena-auth-method "keys" --username "ACCESS_KEY" --password "SECRET_KEY"
# Connect via SSH tunnel
db-client-tui connections add postgresql --name "RemoteDB" --server "db-host" --username "dbuser" --password "dbpass" \
--ssh-enabled --ssh-host "ssh.example.com" --ssh-username "sshuser" --ssh-auth-type password --ssh-password "sshpass"
# Fetch password from a secrets manager (1Password, pass, Vault, etc.)
db-client-tui connections add postgresql --name "ProdDB" --server "prod.example.com" --username "dbuser" \
--password-command "op read 'op://Work/prod-db/password'"
# Temporary (not saved) connection
db-client-tui connect sqlite --file-path "/path/to/database.db"
# Connect via URL - scheme determines database type (postgresql://, mysql://, sqlite://, etc.)
db-client-tui postgresql://user:pass@localhost:5432/mydb
db-client-tui mysql://root@localhost/testdb
db-client-tui sqlite:///path/to/database.db
# Save a connection via URL
db-client-tui connections add --url dbtype://user:pass@host/db --name "MyDB"
# Provider-specific CLI help
db-client-tui connect -h
db-client-tui connect supabase -h
db-client-tui connections add -h
db-client-tui connections add supabase -h
# Manage connections
db-client-tui connections list
db-client-tui connections delete "MyConnection"
Keybindings
| Key | Action |
|---|---|
i |
Enter INSERT mode |
Esc |
Back to NORMAL mode |
e / q / r |
Focus Explorer / Query / Results |
s |
SELECT TOP 100 from table |
h |
Query history |
d |
Clear query |
n |
New query (clear all) |
y |
Copy query (when query editor is focused) |
v / y / Y / a |
View cell / Copy cell / Copy row / Copy all |
Ctrl+Q |
Quit |
? |
Help |
Vim Motions (Query Editor, NORMAL mode)
Use with operators like y, d, c (e.g. dw, y$).
| Motion | Action |
|---|---|
h / j / k / l |
Move cursor left / down / up / right |
w / W |
Next word / WORD |
b / B |
Previous word / WORD |
0 / $ |
Line start / end |
gg / G |
File start / end |
f{c} / F{c} |
Find char forward / backward |
t{c} / T{c} |
Till char forward / backward |
% |
Matching bracket |
Commands Menu (<space>)
| Key | Action |
|---|---|
<space>c |
Connect to database |
<space>x |
Disconnect |
<space>z |
Cancel running query |
<space>e |
Toggle Explorer |
<space>f |
Toggle Maximize |
<space>t |
Change theme |
<space>h |
Help |
<space>q |
Quit |
Autocomplete triggers automatically in INSERT mode. Use Tab to accept.
Configuration
Connections and settings are stored in $XDG_CONFIG_HOME/db-client-tui/ (default: ~/.config/db-client-tui/). Override the location by setting DB_CLIENT_TUI_CONFIG_DIR.
Custom keybindings
Edit the keymap.json file in your db-client-tui config dir. See config/keymap.template.json for the full default keymap. Keymap.json need to only contain the overriding keymaps.
FAQ
How are sensitive credentials stored?
Connection details are stored in connections.json inside the config directory, but passwords are stored in your OS keyring when available (macOS Keychain, Windows Credential Locker, Linux Secret Service).
How does db-client-tui compare to Harlequin, Lazysql, etc.?
db-client-tui is inspired by lazygit - you can just jump in and there's no need for external documentation. The keybindings are shown at the bottom of the screen and the UI is designed to be intuitive without memorizing shortcuts.
Key differences:
- No need for external documentation - db-client-tui embrace the "lazy" approach in that a user should be able to jump in and use it right away intuitively. There should be no setup instructions. If python packages are required for certain adapters, db-client-tui will help you install them as you need them.
- No CLI config required - Just run
db-client-tuiand pick a connection from the UI - Lightweight - While Lazysql or Harlequin offer more features, I experienced that for the vast majority of cases, all I needed was a simple and fast way to connect and run queries. db-client-tui is focused on doing a limited amount of things really well.
Inspiration
db-client-tui is built with Textual and inspired by:
Contributing
See CONTRIBUTING.md for development setup, testing, and CI steps.
Driver Reference
Most of the time you can just run db-client-tui and connect. If a Python driver is missing, db-client-tui will show (and often run) the right install command for your environment.
| Database | Driver package | pipx |
pip / venv |
|---|---|---|---|
| SQLite | (built-in) | (built-in) | (built-in) |
| PostgreSQL / CockroachDB / Supabase | psycopg2-binary |
pipx inject db-client-tui psycopg2-binary |
python -m pip install psycopg2-binary |
| SQL Server | mssql-python |
pipx inject db-client-tui mssql-python |
python -m pip install mssql-python |
| MySQL | PyMySQL |
pipx inject db-client-tui PyMySQL |
python -m pip install PyMySQL |
| MariaDB | PyMySQL |
pipx inject db-client-tui PyMySQL |
python -m pip install PyMySQL |
| Oracle | oracledb |
pipx inject db-client-tui oracledb |
python -m pip install oracledb |
| DuckDB | duckdb |
pipx inject db-client-tui duckdb |
python -m pip install duckdb |
| ClickHouse | clickhouse-connect |
pipx inject db-client-tui clickhouse-connect |
python -m pip install clickhouse-connect |
| Turso | libsql |
pipx inject db-client-tui libsql |
python -m pip install libsql |
| Cloudflare D1 | requests |
pipx inject db-client-tui requests |
python -m pip install requests |
| Snowflake | snowflake-connector-python |
pipx inject db-client-tui snowflake-connector-python |
python -m pip install snowflake-connector-python |
| Firebird | firebirdsql |
pipx inject db-client-tui firebirdsql |
python -m pip install firebirdsql |
| Athena | pyathena |
pipx inject db-client-tui pyathena |
python -m pip install pyathena |
| BigQuery | google-cloud-bigquery |
pipx inject db-client-tui google-cloud-bigquery |
python -m pip install google-cloud-bigquery |
| Spanner | google-cloud-spanner |
pipx inject db-client-tui google-cloud-spanner |
python -m pip install google-cloud-spanner |
| Apache Arrow Flight SQL | adbc-driver-flightsql |
pipx inject db-client-tui adbc-driver-flightsql |
python -m pip install adbc-driver-flightsql |
| Apache Impala | impyla |
pipx inject db-client-tui impyla |
python -m pip install impyla |
| Trino | trino |
pipx inject db-client-tui trino |
python -m pip install trino |
| SurrealDB | surrealdb |
pipx inject db-client-tui surrealdb |
python -m pip install surrealdb |
| osquery | osquery |
pipx inject db-client-tui osquery |
python -m pip install osquery |
SSH Tunnel Support
SSH tunnel functionality requires additional dependencies. Install with the ssh extra:
# pipx
pipx install 'db-client-tui[ssh]'
# uv
uv tool install 'db-client-tui[ssh]'
# pip
pip install 'db-client-tui[ssh]'
If you try to create an SSH connection without these dependencies, db-client-tui will detect this and show you the exact command to install them for your environment.
Star History
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file db_client_tui-0.1.1.tar.gz.
File metadata
- Download URL: db_client_tui-0.1.1.tar.gz
- Upload date:
- Size: 10.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5231c95b59f2e7fa2deee0bd03abdbd6cdacf7a7974fdeffd9988891ace052c
|
|
| MD5 |
41ff63c0c85353b31b315090e6206a3b
|
|
| BLAKE2b-256 |
bdeca54bf4a64c0afbad05b6f7802b0086979a4be6d8d83cf1978b8ffe38fab8
|
File details
Details for the file db_client_tui-0.1.1-py3-none-any.whl.
File metadata
- Download URL: db_client_tui-0.1.1-py3-none-any.whl
- Upload date:
- Size: 729.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fe17ebc9ba375d25f0a81cdcfc596e607f89d1ef2976397092b4541a96bd221
|
|
| MD5 |
398a585eb7f5828b3a346c845518f1f3
|
|
| BLAKE2b-256 |
4e96048fd4430088df79d36da54ee081cd5f117acac1db2cb490a196c0287f67
|