| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Firebolt CLI; work with Firebolt and Firebolt Core.
➤ fb select 42
?column?
---------
42
Time: 41.051ms
➤ fb
=> select 42
?column?
---------
42
Time: 40.117ms
=> create table t (a int);
Table 't' already exists.
Time: 87.747ms
=> insert into t select * from generate_series(1, 100000000);
/
Also support history + search in it (CTRL+R).
➤ fb --help Usage: fb [OPTIONS] Positional arguments: query Query command(s) to execute. If not specified, starts the REPL Optional arguments: -c, --command COMMAND Run a single command and exit -C, --core Preset of settings to connect to Firebolt Core -h, --host HOSTNAME Hostname (and port) to connect to -d, --database DATABASE Database name to use -f, --format FORMAT Output format (e.g., TabSeparatedWithNames, PSQL, JSONLines_Compact, Vertical, ...) -e, --extra EXTRA Extra settings in the form --extra <name>=<value> -l, --label LABEL Query label for tracking or identification -j, --jwt JWT JWT for authentication --sa-id SA-ID Service Account ID for OAuth authentication --sa-secret SA-SECRET Service Account Secret for OAuth authentication --jwt-from-file Load JWT from file (~/.firebolt/jwt) --oauth-env OAUTH-ENV OAuth environment to use (e.g., 'app' or 'staging'). Used for Service Account authentication (default: staging) -v, --verbose Enable extra verbose output --concise Suppress time statistics in output --hide-pii Hide URLs that may contain PII in query parameters --no-spinner Disable the spinner in CLI output --update-defaults Update default configuration values -V, --version Print version --help Show help message and exit
The easiest way to install fb is to download a release binary from GitHub Releases.
Open the latest release and download the asset that matches your OS and CPU:
| Asset | Platform |
|---|---|
| fb-linux-static-amd64 | Linux amd64 (Intel/AMD 64-bit) |
| fb-linux-static-arm64 | Linux arm64 |
| fb-darwin-amd64 | macOS Intel (amd64) |
| fb-darwin-arm64 | macOS Apple Silicon (arm64) |
Make it executable and install it as fb on your PATH (use the exact filename you downloaded):
chmod +x ./fb-linux-static-amd64
sudo mv ./fb-linux-static-amd64 /usr/local/bin/fbOr install to your user directory (no sudo):
mkdir -p ~/.local/bin
chmod +x ./fb-linux-static-amd64
mv ./fb-linux-static-amd64 ~/.local/bin/fbEnsure ~/.local/bin is on your PATH (e.g. in ~/.bashrc or ~/.zshrc).
Run fb --version to confirm.
Use this if you prefer to compile locally or need a platform not covered by release binaries.
Install Rust and cargo. Add source "$HOME/.cargo/env" to ~/.bashrc or ~/.zshrc if the installer suggests it.
On Ubuntu/Debian, install build dependencies:
sudo apt install pkg-config libssl-devClone the repo and install:
git clone git@github.com:firebolt-db/fb-cli.git
cd fb-cli
cargo install --path . --lockedRun fb (or ~/.cargo/bin/fb if your shell has not picked up Cargo’s bin directory yet).
Most of them from https://github.com/kkawakam/rustyline:
| Keystroke | Action |
|---|---|
| Enter | Finish the line entry |
| Ctrl-R | Reverse Search history (Ctrl-S forward, Ctrl-G cancel) |
| Ctrl-U | Delete from start of line to cursor |
| Ctrl-W | Delete word leading up to cursor (using white space as a word boundary) |
| Ctrl-Y | Paste from Yank buffer |
| Ctrl-_ | Undo |
Some of them specific to fb:
| Keystroke | Action |
|---|---|
| Ctrl-C | Cancel current input. |
| Ctrl-O | Insert a newline |
Can update defaults one and for all by specifying --update-defaults: during this application old defaults are not applied.
New defaults are going to be stored at ~/.firebolt/fb_config.
~ ➤ fb select 42
?column?
---------
42
Time: 40.342ms
~ ➤ fb select 42 --format CSVWithNames --concise --update-defaults
"?column?"
42
~ ➤ fb select 42
"?column?"
42
~ ➤ fb select 42 --verbose # defauls are merged with new args
URL: http://localhost:8123/?database=local_dev_db&mask_internal_errors=1
QUERY: select 42
"?column?"
42
Specify:
Note: The token is saved in ~/.firebolt/fb_sa_token/ and will be reused if the account ID and secret match and the token is less than half an hour old.
➤ fb --sa-id=${SA_ID} --sa-secret=${SA_SECRET} --oauth-env=app \
-h ${ACCOUNT_ID}.api.us-east-1.app.firebolt.io -d ${DATABASE_NAME}
Read more about getting service accounts here.
Specify:
➤ fb --host api.us-east-1.app.firebolt.io --verbose --extra account_id=12312312312 --jwt 'eyJhbGciOiJSUzI1NiI...'
=> show engines
URL: https://api.us-east-1.app.firebolt.io/?database=db_1&account_id=12312312&output_format=JSON&advanced_mode=1
QUERY: show engines
┌─engine_name─────────────┬─engine_owner────────────────┬─type─┬─nodes─┬─clusters─┬─status───────────────┬─auto_start─┬─auto_stop─┬─initially_stopped─┬─url────────────────────────────────────────────────────────────────────────────────────────────────────┬─default_database───────────────────┬─version─┬─last_started──────────────────┬─last_stopped──────────────────┬─description─┐
│ pre_demo_engine1 │ user@firebolt.io │ S │ 2 │ 1 │ ENGINE_STATE_STOPPED │ t │ 20 │ f │ api.us-east-1.app.firebolt.io?account_id=1321231&engine=pre_demo_engine1 │ │ latest │ 2024-02-07 01:19:19.81689+00 │ 2024-02-07 01:44:15.930845+00 │ │
│ pre_demo_engine2 │ user@firebolt.io │ S │ 2 │ 1 │ ENGINE_STATE_STOPPED │ t │ 20 │ f │ api.us-east-1.app.firebolt.io?account_id=1321231&engine=pre_demo_engine2 │ pre_demo_validation_testdb1 │ latest │ 2024-02-07 01:21:36.274962+00 │ 2024-02-07 02:32:05.403539+00 │ │
└─────────────────────────┴─────────────────────────────┴──────┴───────┴──────────┴──────────────────────┴────────────┴───────────┴───────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────┴─────────┴───────────────────────────────┴───────────────────────────────┴─────────────┘
=> set engine=user5_engine_1
URL: https://api.us-east-1.app.firebolt.io/?database=db_1&engine=user5_engine_1&account_id=1321231&output_format=JSON&advanced_mode=1
=> select 42
URL: https://api.us-east-1.app.firebolt.io/?database=db_1&engine=user5_engine_1&account_id=1321231&output_format=JSON&advanced_mode=1
QUERY: select 42
?column?
---------
42
Time: 275.639ms
In interactive mode one can dynamically update extra arguments:
=> select E'qqq';
URL: http://localhost:8123/?database=local_dev_db
QUERY: select E'qqq';
?column?
---------
qqq
Time: 40.745ms
=> set format = Vertical;
=> select E'qqq';
URL: http://localhost:8123/?database=local_dev_db
QUERY: select E'qqq';
Row 1:
──────
?column?: qqq
Time: 38.888ms
=> set cool_mode=disabled;
=> select E'qqq';
URL: http://localhost:8123/?database=local_dev_db&cool_mode=disabled
QUERY: select E'qqq';
Unknown setting cool_mode
Time: 36.802ms
=> unset cool_mode
=> select E'qqq';
URL: http://localhost:8123/?database=local_dev_db
QUERY: select E'qqq';
Row 1:
──────
?column?: qqq
Time: 39.395ms
=> set enable_result_cache=disabled;
=> select E'qqq';
URL: http://localhost:8123/?database=local_dev_db&enable_result_cache=disabled
QUERY: select E'qqq';
Row 1:
──────
qqq: qqq
Time: 41.671ms
=> unset enable_result_cache;
=> select E'qqq';
URL: http://localhost:8123/?database=local_dev_db
QUERY: select E'qqq';
Row 1:
──────
?column?: qqq
Time: 39.453ms
=>
See LICENSE.
| Back | FazBrowse Home | New Git URL |