Calcite CLI is a command-line interface for executing SQL queries using Calcite or Phoenix servers via Avatica. It provides a prompt where you can enter queries and view the results.
go build -v -ldflags="-s -w" -o calcite-cliTo install Calcite CLI, you can use the following command:
go install github.com/satyakommula96/calcite-cli@latestAfter installing Calcite CLI, you can run it using the following command:
calcite-cli [flags]Flags:
-h, --help Help for calcite
-m, --maxRowsTotal string The maximum number of rows to return for a given query
--params string Extra parameters for avatica connection (ex: "parameter1=value&...parameterN=value")
-p, --password string The password to use when authenticating against Avatica
-s, --schema string The schema path sets the default schema to use for this connection.
--serialization string Serialization parameter (defaults to protobuf)
--url string Connection URL (default "http://localhost:8080")
-u, --username string The user to use when authenticating against Avatica
Once the Calcite CLI prompt starts, you can enter your SQL queries. To exit the prompt, type exit or quit.
To run a test database locally using Docker, you can launch an Apache Phoenix Query Server (which runs Avatica under the hood):
docker run -d \
-p 2181:2181 \
-p 8765:8765 \
-p 16000:16000 \
-p 16010:16010 \
-p 16020:16020 \
--name phoenix-server \
boostport/hbase-phoenix-all-in-one:latestAfter the container starts and initializes (takes ~15-30 seconds), connect your client:
./calcite-cli --url "http://localhost:8765"This project uses the following third-party dependencies:
- github.com/apache/calcite-avatica-go/v5
- github.com/olekukonko/tablewriter
- github.com/spf13/cobra
- github.com/aranjan7/go-prompt
That's the basic usage of the Calcite CLI. You can customize the connection URL and other parameters using command flags.
Happy querying!
This project is licensed under the Apache License. See the LICENSE file for more information.