Skip to main content

DbCls

DbCls is a terminal database client in which a SQL editor and visidata work as one thing: you write the query in an editor with syntax highlighting and schema-aware autocomplete, and its result opens straight away as an interactive table you can filter, sort, pivot, reshape, chart and drill into. On top of that sits a pipeline language that turns the editor into the place multi-step work happens — "collect ids from one query, run them against every shard, show progress" — right inside the .sql file, instead of in a throwaway Python script.

Key capabilities

Editor

  • SQL editor with syntax highlighting, >>> ... <<< block folding, search, undo/redo and a command palette
  • Schema-aware autocomplete ranked by SQL context: tables, columns, table aliases, functions, keywords
  • Beautify SQL (Ctrl+B), read-only mode, remappable key codes and a tmux-style Ctrl+X prefix

Pipelines

  • Steps chained with | right in the editor: SQL, Python, regex filters, loops, functions, variables
  • Prompts mid-run (choose / select / input / ask) — a pipeline becomes a small tool a colleague can use without knowing the schema
  • A pipeline is just text in your .sql file: save it, version it, re-run it

LLM chat (optional)

  • Ctrl+L — a model writes and fixes queries, reading your schema through read-only tools
  • Any OpenAI-compatible endpoint (Ollama, vLLM, OpenRouter, a corporate proxy); nothing to install

Data

  • The whole of visidata: filtering, sorting, pivots, frequency tables, joins between sheets
  • DB-aware extensions: cross-sheet references, in-terminal charts (plotext), export to SQL INSERT, and table editing that shows you the SQL before anything is committed

Connecting and extending

  • MySQL, PostgreSQL, ClickHouse, SQLite — and Cassandra / ScyllaDB through the driver plugin in plugins/cassandra
  • With no connection arguments it starts on an in-memory SQLite — just open a file and type
  • Unix sockets (including ones forwarded over SSH), JSON config, inactivity screen lock
  • Plugin API: your own editor commands, pipeline commands, syntax highlighters, LLM tools and full-screen windows

Documentation

This page is the short version. The details live in docs/:

Page What is in it
Configuration and connections Command line options, the config file, several connections and tabs, describing a connection in the editor, Unix sockets and SSH tunnels, logging
Editor Hotkeys, fold blocks, syntax highlighting, key remapping and Alt on macOS, the Ctrl+X prefix, autocomplete, beautify, browsing and editing tables
Results in VisiData Sheets, DB-aware hotkeys, JSON / URL / size column types, aggregators, charts, exporting, cross-sheet references, expression functions
Pipelines The language: steps, control flow, functions, live sheets (.WATCH), prompts, helpers, templates, examples
LLM chat Setup, the chat window, questions from the model, approving tool calls, how the answer arrives
Plugins Writing a plugin, where plugins are loaded from, settings, the plugin API, the bundled plugins
Screen lock and password safety Locking the terminal after inactivity, keeping passwords off disk

Demo

Four recordings of a real session — the captions under the terminal say what is happening and which key was pressed.

The editor

Syntax highlighting, Ctrl+B to beautify, schema-aware autocomplete, the database and table browsers, and editing table data with the SQL shown before anything is committed. See Editor Commands.

Editor

The result

Every query opens as a visidata sheet: sorting, a frequency table, key columns and an in-terminal chart. See Data Visualization.

Data

Pipelines in the editor

A chain of steps in the editor: a prompt in the middle of a run, a fan-out over shards, a live monitor, and a file of named blocks used as a menu. See Pipelines.

Pipelines

The model

Ctrl+L — the model reads the schema through read-only tools and hands back a query, then a pipeline. See LLM Chat.

LLM chat

Installation

pip install dbcls

Cassandra / ScyllaDB is not part of the package: it is a driver plugin in this repository, loaded from a checkout.

pip install scylla-driver
dbcls --plugin-dir ./plugins -E cassandra -H node1 -P 9042 -u admin -d my_keyspace

The LLM chat needs nothing installed — it talks to the endpoint over the standard library and is switched on by configuration alone.

Quick Start

With no connection arguments at all, dbcls opens the file on an in-memory SQLite database — enough to try the editor, the pipelines and the visidata integration on CREATE TABLE / INSERT of your own:

dbcls scratch.sql

Basic usage with command line arguments:

dbcls -H 127.0.0.1 -u user -p mypasswd -E mysql -d mydb mydb.sql

A JSON config file does the same job as the options, and holds several connections at once — one tab each:

dbcls -c config.json mydb.sql
{
    "connections": {
        "mysql01": {"engine": "mysql", "host": "127.0.0.1", "username": "user",
                    "ask_password": true, "dbname": "shop", "filename": "mysql.sql"},
        "local":   {"engine": "sqlite3", "dbfilepath": "test.sqlite", "filename": "local.sql"}
    }
}

Every option, the config file keys, tabs and the in-editor connection form are in Configuration and connections; F1 inside dbcls opens the same help.

Supported Database Engines

  • MySQL
  • PostgreSQL
  • ClickHouse
  • SQLite
  • Cassandra / ScyllaDB — as a driver plugin: pip install scylla-driver and start with --plugin-dir ./plugins

A database not on this list is added from outside, without touching dbcls: a plugin registers its own engine with setup.add_engine(...), and it is then a --engine, an "engine" in the config file and an entry in the connection form like any other. plugins/cassandra is the worked example.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request or submit an issue on GitHub Issues

License

here

Metadata

Release files for dbcls 1.4.14

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

Source distribution (sdist)

Source distribution for dbcls 1.4.14
File Size Uploaded Provenance Actions
dbcls-1.4.14.tar.gz 363.7 kB Without provenance Details for dbcls-1.4.14.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dbcls 1.4.14
File Interpreter ABI Platform Actions
dbcls-1.4.14-py3-none-any.whl Python 3 none any Details for dbcls-1.4.14-py3-none-any.whl

Total release size: 756.1 kB

Release files / dbcls-1.4.14.tar.gz

Download URL dbcls-1.4.14.tar.gz
Size 363.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9ed3f7f0174d5f75f4a9ca1727ecbf27b24f51dbfccc360668b4cedcb208c9ca
BLAKE2b-256 checksum
How to use checksums
df25313d7013f37cd9c2659fdf4b8388d58d7a1ebe6a73bc0ad31d2308e0e8a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / dbcls-1.4.14-py3-none-any.whl

Download URL dbcls-1.4.14-py3-none-any.whl
Size 392.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0c1508bafa11fe64d084d61a76475f59b5888489406d4e14cf688dfb80ea7545
BLAKE2b-256 checksum
How to use checksums
5df78c0a548b5b753dcb854db9885f65011f2b00b84fa7b04e0274020865b9a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for dbcls 1.4.14

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.

Release history Release notifications | RSS feed

This release

1.4.14 This release

2 release files No provenance

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