a database tool for the terminal
a database tool for the terminal
the goal for rainfrog is to provide a lightweight, terminal-based tool for interacting with databases.
the levels of support for different databases can be split into 4 tiers:
| database | tier | known issues | via wire protocol* |
|---|---|---|---|
| postgres | 1 | ||
| mysql | 2 | ||
| sqlite | 2 | ||
| redshift | 2 | postgres | |
| duckdb | 2 | prebuilt android, i686, and musl binaries do not include this driver | |
| oracle | 3 | requires additional runtime dependencies |
*the postgres driver can also be used to connect to other databases that support the postgres wire protocol, such as AWS Redshift. however, this functionality is not well tested. in theory, the mysql driver should be able to do the same for databases that support the mysql protocol. check each database's documentation for compatibility.
this software is currently under active development; expect breaking changes, and use at your own risk. it is not recommended to use this tool with write access on a production database.
after installing rust (recommended to do so via rustup):
cargo install rainfrog --lockedby default, all features are included. some features may not be compatible with your platform; check Cargo.toml to see what feature combinations are available.
if you have cargo-binstall, you can run:
cargo binstall rainfrogbrew install rainfrogarch linux users can install from the official repositories using pacman:
pacman -S rainfrogif you are using termux, you'll need to install rust via their package manager:
pkg install rustand then make sure to install with termux features (and disable default features):
cargo install rainfrog --no-default-featuresnix-env -iA nixos.rainfrogconda install -c conda-forge rainfrogThe command below installs rainfrog from conda-forge, the same repository as conda, but unlike conda it can be installed user-globally using pixi.
pixi global install rainfrogthere is a simple install script that assists in downloading and unpacking a
binary from the release page to ~/.local/bin/, which you might want to add to
your PATH variable if it isn't already there. you'll need to select which
binary is appropriate for your system (if you're not sure, you can find out by
installing rust and running rustc -vV to see the "host" target), and the
script also needs jq and
fzf installed to run.
curl -LSsf https://raw.githubusercontent.com/achristmascarl/rainfrog/main/install.sh | bashrustc -vV to see the "host" target)PATH environment variableyou will need to have a nerd font installed and used by your terminal for the icons to show up.
for some of the databases supported by rainfrog, the driver has additional runtime dependencies. you can find instructions for installing those dependencies below.
the oracle driver uses ODPI-C, which requires Oracle Client libraries to be installed. instructions for installing the Oracle Instant Client can be found here: ODPI-C Installation.
after installation, you may need to manually copy the client files to a location where ODPI-C can find them, which is either in the same folder as the rainfrog binary, or in the library path of your os. more details can be found in the ODPI-C installation instructions: ODPI-C Client Library Loading.
…if any options are not provided, you will be prompted to input them. if you do not provide an input, that option will default to what is in your environment variables.
rainfrog \
--driver <db_driver> \
--username <username> \
--host <hostname> \
--port <db_port> \
--database <db_name> \
--ssl-requiredthe connection_url must include all the necessary options for connecting
to the database (ex. postgres://username:password@localhost:5432/postgres).
it will take precedence over all connection options.
rainfrog --url $(connection_url) --ssl-required--ssl-required overrides the transport setting from a connection URL. It selects
PostgreSQL's require mode, MySQL's required mode, or Oracle's tcps protocol.
SQLite and DuckDB do not support SSL/TLS connections. Advanced certificate and
verification settings can still be supplied in PostgreSQL and MySQL URL parameters,
or through an Oracle Easy Connect string and Oracle client configuration.
if connection_url is not present, rainfrog will first check your DATABASE_URL
environment variable, then it will check for DATABASE_URL in a .env file in
the current directory or a parent directory.
docker runfor postgres and mysql, you can run it by specifying all of the options as environment variables:
docker run --platform linux/amd64 -it --rm --name rainfrog \
--add-host host.docker.internal:host-gateway \
-e db_driver="db_driver" \
-e username="<username>" \
-e password="<password>" \
-e hostname="host.docker.internal" \
-e db_port="<db_port>" \
-e db_name="<db_name>" achristmascarl/rainfrog:latestif you want to provide a custom combination of options and omit others, you can override the Dockerfile's CMD like so:
docker run --platform linux/amd64 -it --rm --name rainfrog \
achristmascarl/rainfrog:latest \
rainfrog # overrides CMD, additional options would come aftersince sqlite is file-based, you may need to mount a path to the sqlite db as a volume in order to access it:
docker run --platform linux/amd64 -it --rm --name rainfrog \
-v ~/code/rainfrog/dev/rainfrog.sqlite3:/rainfrog.sqlite3 \
achristmascarl/rainfrog:latest \
rainfrog --url sqlite:///rainfrog.sqlite3running drivers which have runtime dependencies (like oracle) via docker is not currently supported.
rainfrog can be customized by placing a rainfrog_config.toml file in
one of the following locations depending on your os, as determined by
the directories crate:
| Platform | Value | Example |
|---|---|---|
| Linux | $XDG_CONFIG_HOME/_project_path_ or $HOME/.config/_project_path_ |
/home/alice/.config/barapp |
| macOS | $HOME/Library/Application Support/_project_path_ |
/Users/Alice/Library/Application Support/com.Foo-Corp.Bar-App |
| Windows | {FOLDERID_LocalAppData}\_project_path_\config |
C:\Users\Alice\AppData\Local\Foo Corp\Bar App\config |
you can change the default config directory by exporting an environment variable. to make the change permanent, add it to your .zshrc/.bashrc/.*rc file:
export RAINFROG_CONFIG=~/.config/rainfrog[!WARNING] this should be the path to the directory that the config file is in, NOT the path to the actual file
| Name | Default | Description |
|---|---|---|
| mouse_mode | true |
whether to capture mouse events. capturing mouse events allows you to change focus and scroll using the mouse. however, your terminal will not handle mouse events like it normally does (you won't be able to copy by highlighting, for example). |
| data_compact_columns | true |
whether column widths should be dynamic based on the length of the contents of each column. there is still a max column width that won't be exceeded, so this will save some space by compressing the widths of columns with shorter strings. |
| data_row_spacer | false |
whether rows will have a space separating them to make the data table less visually dense. |
| autocomplete_enabled | true |
whether completions are requested while editing SQL. |
| autocomplete_debounce_ms | 100 |
how long edit-triggered completion waits before refreshing or hiding the menu. |
| autocomplete_trigger_len | 1 |
minimum identifier length for automatic completi |
No open issues yet, or sync has not completed.