Crates.io | tisq |
lib.rs | tisq |
version | 0.0.4 |
source | src |
created_at | 2023-10-08 09:23:52.324254 |
updated_at | 2023-11-01 23:40:44.665605 |
description | terminal UI for SQL databases |
homepage | |
repository | |
max_upload_size | |
id | 997030 |
size | 715,872 |
TisQ [tɪz-kjuː] stands for Terminal Interface for SQL Queries.
Features:
In active development. Not ready for production use, there are no tests, incomplete error handling, program can crash on some inputs.
Note that version published on crates.io is a dummy, as it is not possible to publish correct build here due to use of git dependencies. Versions published on GitHub are correct.
Only Postgres is supported at the moment and with very limited set of types.
In bash shell run:
curl -s https://raw.githubusercontent.com/strowk/tisq/main/install.sh | bash
Tested on Linux bash and Windows Git Bash. Should work for MacOS too.
By default the script would try to install TisQ to /usr/local/bin
and would require sudo rights for that,
but you can disable this behavior by setting NO_SUDO
environment variable:
curl -s https://raw.githubusercontent.com/strowk/tisq/main/install.sh | NO_SUDO=1 bash
Sudo is disabled by default for Windows Git Bash.
If your system/architecture is not supported by the script above, you can install Rust and install TisQ from sources:
git clone https://github.com/strowk/tisq
cargo install --path ./tisq
You can run TisQ in Docker container:
docker run -it --rm ghcr.io/strowk/tisq:main-debian
# or
docker run -it --rm ghcr.io/strowk/tisq:main-alpine
Note that the version in main-*
tags would be from the latest commit in main
branch.
Builds are provided based on Debian and Alpine Linux with x86_64 and aarch64 architectures.
Some of following keybindings are configurable and could be adjusted in configuration
file that is located under home folder in .tisq/config.toml
.
The format for this file could be illustrated by the following example:
# Firstly specify the section for keybindings
[keybindings.globals] # word "globals" here is a name of the keybinding config section
# Then use keybinding name as a key and list of possible key presses as a value
GlobalExit = [
# This would allow to use Esc key without any modifiers
{ modifiers = "", key = { type = "Esc" } },
# Or, alternatively use Ctrl+C combination, both would work
{ modifiers = "Ctrl", key = { type = "Char", args = "c" } },
]
In this example it is demonstrated how to specify special keys, such as Esc,
using simple type = "Esc"
and how characters are specified using type = "Char"
with args
field that contains the character.
Config section: globals
.
Default Keybindings | Description | Config name |
---|---|---|
Ctrl+c, Esc | Quit | GlobalExit |
Alt+Left / Ctrl+Alt+Left | Navigate Left | GlobalNavigateLeft |
Alt+Right / Ctrl+Alt+Right | Navigate Right | GlobalNavigateRight |
Alt+Up / Ctrl+Alt+Up | Navigate Up | GlobalNavigateUp |
Alt+Down / Ctrl+Alt+Down | Navigate Down | GlobalNavigateDown |
Config section: browser
.
Default Keybindings | Description | Config name |
---|---|---|
a | Add new server | BrowserAddServer |
Delete | Delete server | - |
q | Open query editor for selected database | BrowserDatabaseOpenQueryEditor |
Up, Down | Navigate | - |
Right, Left | Open,close node | - |
Config section: editor
.
Default Keybindings | Description | Config name |
---|---|---|
Ctrl+PageUp | Previous query editor tab | EditorPrevTab |
Ctrl+PageDown | Next query editor tab | EditorNextTab |
Ctrl+Alt+Enter / Ctrl+E / Ctrl+R | Execute query | EditorExecute |
Ctrl+W | Close editor tab | EditorCloseTab |
Ctrl+Space | Attempt to expand snippet | EditorTryExpand |
Ctrl+/ | Comment or uncomment line | EditorToggleComment |
Config section: result
.
Default Keybindings | Description | Config name |
---|---|---|
Ctrl+Left | Scroll columns to left | ResultOffsetColumnLeft |
Ctrl+Right | Scroll columns to right | ResultOffsetColumnRight |
Up, Down | Move selected line pointer | - |
PageUp, PageDown | Move by page | - |
Snippets are small shortcuts that can be expanded into SQL code.
Currently only standard Postgres snippets are supported, but in future it will be possible to add custom snippets.
Snippet | Expansion |
---|---|
cq |
Current queries |
ds |
Databases sizes |
ts |
Tables sizes |
cl |
Current locks |
sel |
SELECT * FROM |
ins |
INSERT INTO |
upd |
UPDATE |
del |
DELETE FROM |
cre |
CREATE TABLE |
alt |
ALTER TABLE |
dro |
DROP TABLE |
trun |
TRUNCATE TABLE |