pinot-clients/pinot-cli/README.md
An interactive and batch command-line client for Apache Pinot. It supports a rich interactive REPL, multiple output formats, history, pagination, configuration files, and batch execution.
From the repository root:
./mvnw -DskipTests -pl pinot-clients/pinot-cli -am package
Artifacts:
pinot-clients/pinot-cli/target/pinot-cli-*-executable.jar (executable, recommended)pinot-clients/pinot-cli/target/pinot-cli-1.5.0-SNAPSHOT.jar (thin)pinot-clients/pinot-cli/target/pinot-cli-*-executable.jar \
-u jdbc:pinot://<controller-host>:<port>
; to execute.help, clear, exit, quit.~/.pinot_history (customize with --history-file).less) via --pager or environment variables below.Execute a single statement:
pinot-clients/pinot-cli/target/pinot-cli-*-executable.jar \
-u jdbc:pinot://<controller-host>:<port> \
--output-format=CSV_HEADER \
--execute "SELECT * FROM myTable LIMIT 3;"
Execute statements from a file:
pinot-clients/pinot-cli/target/pinot-cli-*-executable.jar \
-u jdbc:pinot://<controller-host>:<port> \
--output-format=JSON \
-f queries.sql
-u, --url JDBC URL. Example: jdbc:pinot://controller:9000 or jdbc:pinotgrpc://controller:9000 (required)-n, --user Username-p, --password Password--header Extra request header key=value (repeatable), e.g., --header Authorization=Bearer <token>--set Query/session option key=value (repeatable). Forwarded as connection properties-e, --execute Execute SQL and exit-f, --file Execute SQL from file and exit-o, --output Legacy: table|csv|json (backward compatibility). Prefer the formats below--output-format Batch output format--output-format-interactive Interactive output format (default: ALIGNED)--pager Pager program used in interactive mode (e.g., less -SRFXK). Empty disables pagination--history-file Path to history file for interactive mode (default: ~/.pinot_history)--config Path to a properties file with defaults (see Configuration below)--debug Print stack traces and timing diagnostics to stderrAvailable values for --output-format and --output-format-interactive (case-insensitive):
CSV, CSV_HEADER, CSV_UNQUOTED, CSV_HEADER_UNQUOTEDTSV, TSV_HEADERJSON (one JSON object per line)ALIGNED (ASCII table)VERTICAL (record-oriented)AUTO (chooses ALIGNED if it fits terminal width, otherwise VERTICAL)MARKDOWN (Markdown table)NULL (suppress normal results; useful for timing/error checks)You can load defaults from a properties file using --config or via environment variables:
PINOT_CONFIG (preferred)Supported keys in the properties file (CLI flags take precedence):
server (maps to --url)user, passwordoutput-format, output-format-interactive, outputpager, history-file, debugheaders.* (e.g., headers.Authorization=Bearer <token>) -> becomes extra headers--set key=value)Example pinot-cli.properties:
server=jdbc:pinot://localhost:9000
user=alice
output-format-interactive=AUTO
pager=less -SRFXK
history-file=/Users/alice/.pinot_history
headers.Authorization=Bearer abc123
debug=true
timeoutMs=60000
Run with:
PINOT_CONFIG=/path/to/pinot-cli.properties \
pinot-clients/pinot-cli/target/pinot-cli-*-executable.jar
PINOT_CONFIG: path to a config properties filePINOT_PAGER: pager command for interactive mode (e.g., less -SRFXK)Interactive with AUTO format and pager:
pinot-clients/pinot-cli/target/pinot-cli-*-executable.jar \
-u jdbc:pinot://localhost:9000 \
--output-format-interactive=AUTO \
--pager "less -SRFXK"
Batch to JSON:
pinot-clients/pinot-cli/target/pinot-cli-*-executable.jar \
-u jdbc:pinot://localhost:9000 \
--output-format=JSON \
--execute "SELECT col1, col2 FROM myTable LIMIT 3;"