{"id":14973860,"url":"https://github.com/sets88/dbcls","last_synced_at":"2025-10-27T02:31:41.599Z","repository":{"id":190869780,"uuid":"683332044","full_name":"Sets88/dbcls","owner":"Sets88","description":"DbCls is a versatile terminal client that supports various databases","archived":false,"fork":false,"pushed_at":"2024-07-19T16:39:57.000Z","size":420,"stargazers_count":18,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-11T09:05:39.957Z","etag":null,"topics":["clickhouse","clickhouse-client","db","mysql","postgres","psql"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sets88.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-26T08:15:13.000Z","updated_at":"2024-08-26T05:29:53.000Z","dependencies_parsed_at":"2023-08-26T20:24:36.781Z","dependency_job_id":"7b1c9103-3741-4d80-b382-555ec5dac65c","html_url":"https://github.com/Sets88/dbcls","commit_stats":null,"previous_names":["sets88/dbcls"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sets88%2Fdbcls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sets88%2Fdbcls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sets88%2Fdbcls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sets88%2Fdbcls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sets88","download_url":"https://codeload.github.com/Sets88/dbcls/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219861939,"owners_count":16555980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clickhouse","clickhouse-client","db","mysql","postgres","psql"],"created_at":"2024-09-24T13:49:35.340Z","updated_at":"2025-10-27T02:31:41.581Z","avatar_url":"https://github.com/Sets88.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DbCls\n\nDbCls is a powerful database client that combines the functionality of a SQL editor and data visualization tool. It integrates the kaa editor for SQL query editing and the visidata tool for data representation, providing a seamless experience for database management and data analysis.\n\n## Features\n\n- SQL query editing with syntax highlighting\n- Direct query execution from the editor\n- Data visualization with interactive tables\n- Support for multiple database engines (MySQL, PostgreSQL, ClickHouse)\n- Configuration via command line or config file\n- Table schema inspection\n- Database and table browsing\n- Query history and file-based query storage\n\n## Screenshots\n\n### SQL Editor\n![Editor](/data/editor.png)\n\n### Data Visualization\n![Data representation](/data/data.png)\n\n## Installation\n\n```bash\npip install dbcls\n```\n\n## Quick Start\n\nBasic usage with command line arguments:\n```bash\ndbcls -H 127.0.0.1 -u user -p mypasswd -E mysql -d mydb mydb.sql\n```\n\n### Command Line Options\n\n| Option | Description |\n|--------|-------------|\n| `-H, --host` | Database host address |\n| `-u, --user` | Database username |\n| `-p, --password` | Database password |\n| `-E, --engine` | Database engine (mysql, postgresql, clickhouse) |\n| `-d, --database` | Database name |\n| `-P, --port` | Port number (optional) |\n| `-c, --config` | Path to configuration file |\n| `--no-compress` | Disable compression for ClickHouse connections |\n\n## Configuration\n\n### Using a Config File\n\nYou can use a JSON configuration file instead of command line arguments:\n\n```bash\ndbcls -c config.json mydb.sql\n```\n\nExample `config.json`:\n```json\n{\n    \"host\": \"127.0.0.1\",\n    \"port\": \"3306\",\n    \"username\": \"user\",\n    \"password\": \"mypasswd\",\n    \"dbname\": \"mydb\",\n    \"engine\": \"mysql\"\n}\n```\n\n### Using Bash Configuration\n\nYou can also provide configuration directly from a bash script:\n\n```bash\n#!/bin/bash\n\nCONFIG='{\n    \"host\": \"127.0.0.1\",\n    \"port\": \"3306\",\n    \"username\": \"user\",\n    \"password\": \"mypasswd\",\n    \"dbname\": \"mydb\",\n    \"engine\": \"mysql\"\n}'\n\ndbcls -c \u003c(echo \"$CONFIG\") mydb.sql\n```\n\n## Editor Commands (kaaedit)\n\n### Hotkeys\n\n| Hotkey | Action |\n|--------|--------|\n| `Alt + 1` | Show autocompletion suggestions |\n| `Alt + r` | Execute query under cursor or selected text |\n| `Alt + e` | Show database list with table submenu |\n| `Alt + t` | Show tables list with schema and sample data options |\n| `Ctrl + q` | Quit application |\n| `Ctrl + s` | Save file |\n\nFor more kaaedit hotkeys, visit: https://github.com/kaaedit/kaa\n\n### Navigation in Database and Table Listings\n\nWhen using `Alt + e` (database list) or `Alt + t` (table list), you can navigate through the listings\n\n**Database List Navigation:**\n- Select a database and press `Enter` to proceed to the table list for that database\n\n**Table List Navigation:**\n- Select a table and press `Enter` to access options:\n  - View table schema\n  - Show sample data\n\n## Data Visualization (visidata)\n\n### Hotkeys\n\n| Hotkey | Action |\n|--------|--------|\n| `zf` | Format current cell (JSON indentation, number prettification) |\n\nFor more visidata hotkeys, visit: https://www.visidata.org/man/\n\n## SQL Commands\n\n| Command | Description |\n|---------|-------------|\n| `.tables` | List all tables in current database |\n| `.databases` | List all available databases |\n| `.use \u003cdatabase\u003e` | Switch to specified database |\n| `.schema \u003ctable\u003e` | Display schema for specified table |\n\n## Supported Database Engines\n\n- MySQL\n- PostgreSQL\n- ClickHouse\n- SQLite\n\n\n## Password safety\nTo ensure password safety, I recommend using the project [ssh-crypt](https://github.com/Sets88/ssh-crypt) to encrypt your config file. This way, you can store your password securely and use it with dbcls.\n\nCaveats:\n- If you keep the raw password in a shell script, it will be visible to other users on the system.\n- Even if you encrypt your password inside a shell script, if you pass it to dbcls via the command line, it will be visible in the process list.\n\nTo avoid this, you can use this technique:\n\n```bash\n#!/bin/bash\n\nENC_PASS='{V|B;*R$Ep:HtO~*;QAd?yR#b?V9~a34?!!sxqQT%{!x)bNby^5'\nPASS_DEC=`ssh-crypt -d -s $PASS`\n\nCONFIG=`cat \u003c\u003c EOF\n{\n    \"host\": \"127.0.0.1\",\n    \"username\": \"user\",\n    \"password\": \"$PASS_DEC\",\n    \"dbname\": \"mydb\",\n    \"engine\": \"mysql\"\n}\n`\n\ndbcls -c \u003c(echo \"$CONFIG\") mydb.sql\n```\n\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request or submit an issue on [GitHub Issues](https://github.com/Sets88/dbcls/issues)\n\n## License\n\n[here](https://github.com/Sets88/dbcls/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsets88%2Fdbcls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsets88%2Fdbcls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsets88%2Fdbcls/lists"}