Skip to main content

CLI for Firebolt

Project description

Firebolt-CLI

Nightly code check Unit tests Code quality checks Firebolt Security Scan Integration tests Coverage

Firebolt cli is a tool for connecting to firebolt, managing firebolt resources, and executing queries from the command line.

Quickstart

Prerequisites

python>=3.7 and pip should be installed beforehand. For this go to Python official page.

Also, you will need a firebolt account with information about username, password, database, and engine. For more information go to Firebolt.

Installation

Once you have all prerequisites in place, you can install the firebolt cli via pip:

$ pip install firebolt-cli

To verify the installation run:

$ firebolt --version

firebolt, version 0.2.0

Running

The next step is to configure the firebolt cli:

$ firebolt configure

Username [None]: your_username
Password [None]: ********
Account name [None]: your_firebolt_account_name
Database name [None]: your_database
Engine name or URL [None]: your_engine_name_or_url
Successfully updated firebolt-cli configuration

To run your first query, the engine has to be running. Check the status of the engine by executing the following command:

$ firebolt engine status your_engine_name

Engine your_engine_name current status is: ENGINE_STATUS_SUMMARY_STOPPED

If the engine is stopped, you have to start the engine by executing the following command:

$ firebolt engine start your_engine_name --wait

Engine your_engine_name is successfully started

Now you are ready to run your first query, this could be done by opening the interactive query

$ firebolt query

Connection succeded
firebolt> SELECT * FROM your_table LIMIT 5;
+--------------+-------------+-------------+--------------+
|   l_orderkey |   l_partkey |   l_suppkey | l_shipdate   |
+==============+=============+=============+==============+
|      5300614 |       66754 |        4273 | 1993-02-06   |
+--------------+-------------+-------------+--------------+
|      5300614 |      131772 |        6799 | 1993-02-21   |
+--------------+-------------+-------------+--------------+
|      5300615 |      106001 |        8512 | 1997-12-10   |
+--------------+-------------+-------------+--------------+
|      5300615 |      157833 |        7834 | 1997-12-01   |
+--------------+-------------+-------------+--------------+
|      5300640 |       36106 |        8610 | 1994-09-10   |
+--------------+-------------+-------------+--------------+
firebolt>

Usage

With firebolt cli you can manage the databases and engines, as well as run SQL quires.

$ firebolt --help

Usage: firebolt [OPTIONS] COMMAND [ARGS]...

  Firebolt command line utility.

Options:
  -V, --version  Show the version and exit.
  --help         Show this message and exit.

Commands:
  configure (config)  Store firebolt configuration parameters in config file
  database (db)       Manage the databases
  engine              Manage the engines
  query               Execute sql queries

For more information about a specific command use flag --help, e.g. firebolt database create --help.

Configure

There are three ways to configure firebolt cli:

  1. Run firebolt config and setting all parameters from STDIN.

Or you can set particular parameters by running configure with additional command-line arguments:

$ firebolt config --username your_user_name --account-name firebolt
  1. Pass additional command-line arguments to each command.
$ firebolt query --username your_user_name \
                 --engine-name your_running_engine
  1. Use environment variable
$ export FIREBOLT_USERNAME=your_username
$ export FIREBOLT_PASSWORD=your_password
$ export FIREBOLT_ACCOUNT_NAME=your_account_name
$ export FIREBOLT_API_ENDPOINT=api_endpoint
$ export FIREBOLT_ENGINE_NAME_URL=your_engine_name_or_url
$ export FIREBOLT_ACCESS_TOKEN=access_token
$ firebolt query

Interactive SQL

To enter interactive SQL, firebolt CLI has to be configured using one of three methods from configuration section. Then simply run

$ firebolt query

firebolt> .help
.exit     Exit firebolt-cli
.help     Show this help message
.quit     Exit firebolt-cli
.tables   Show tables in current database
firebolt>

Interactive SQL mode also supports multiline commands and multiple statements;

firebolt> SELECT * FROM your_table
     ...> ORDER BY l_shipdate
     ...> LIMIT 2;
+--------------+-------------+-------------+--------------+
|   l_orderkey |   l_partkey |   l_suppkey | l_shipdate   |
+==============+=============+=============+==============+
|      1552449 |      159307 |        1823 | 1992-01-02   |
+--------------+-------------+-------------+--------------+
|      5431079 |       78869 |        6391 | 1992-01-02   |
+--------------+-------------+-------------+--------------+
firebolt>
firebolt> SELECT * FROM your_table1 LIMIT 1; SELECT * FROM your_table2 LIMIT 2;
+--------------+-------------+-------------+--------------+
|   l_orderkey |   l_partkey |   l_suppkey | l_shipdate   |
+==============+=============+=============+==============+
|      5300614 |       66754 |        4273 | 1993-02-06   |
+--------------+-------------+-------------+--------------+
+-------------+--------------+
|   l_suppkey | l_shipdate   |
+=============+==============+
|        8189 | 1996-03-03   |
+-------------+--------------+
|        8656 | 1996-02-27   |
+-------------+--------------+
firebolt> 

Managing resources

With firebolt-cli it is also possible to manage databases and engines, for the full set of available features please see firebolt engine --help and firebolt database --help.

Ingestion

firebolt-cli also offers data ingestion functionality. For more information see INGEST_GETTING_STARTED.md.

Enable shell completion

Firebolt provides tab completion for Bash (version 4.4 and up), Zsh, and Fish. In order to enable the completion for your environment you have to follow one of the steps below.

Bash

Add this to ~/.bashrc:

eval "$(_FIREBOLT_COMPLETE=bash_source firebolt)"

Zsh

Add this to ~/.zshrc:

eval "$(_FIREBOLT_COMPLETE=zsh_source firebolt)"

Fish

Add this to ~/.config/fish/completions/firebolt.fish:

eval (env _FIREBOLT_COMPLETE=fish_source firebolt)

The completion in firebolt-cli is based on Click library. For more information please visit Click documentation.

Docker

To start the work with docker, you should first pull the docker from the repository.

docker pull ghcr.io/firebolt-db/firebolt-cli:latest

Afterward, you will be able to run the cli and passing all configuration variables as environment variables.

Here is an example of getting a list of available engines:

docker run -e FIREBOLT_USERNAME="your_username"\
           -e FIREBOLT_PASSWORD="your_password"\  
           ghcr.io/firebolt-db/firebolt-cli:latest engine list

Contributing

See: CONTRIBUTING.MD

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

firebolt_cli-0.3.0.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

firebolt_cli-0.3.0-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file firebolt_cli-0.3.0.tar.gz.

File metadata

  • Download URL: firebolt_cli-0.3.0.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.12

File hashes

Hashes for firebolt_cli-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c84f8b6855d5400e4ffdd38be07e99ee023436a89c9f8f851095c51585ad12e7
MD5 a0be08e9a9dd194f436171f0648d0a08
BLAKE2b-256 44f9fc0e5bcd3bf401562ab6ef00530b74cb552fd161e583b29364079a277436

See more details on using hashes here.

File details

Details for the file firebolt_cli-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: firebolt_cli-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.12

File hashes

Hashes for firebolt_cli-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 11d3cc57cb8cbc81443a84ed64461bb40a16ab454982ddaa0f5e1d094b287428
MD5 45b00b0dd1719f6b18640ecd38935959
BLAKE2b-256 e280d4045ad0fca6241041c80e726cddad64bc6e4d5574aba60085060212ce72

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page