Skip to content

sundy-li/arrow_cli

arrow_cli  

Build Status

Overview

arrow_cli is a CLI tool for interacting with a server that speaks the Flight SQL protocol.

Install

cargo install arrow_cli

Usage

> arrow_cli --help
Usage: arrow_cli [OPTIONS]

Options:
  -u, --user <USER>          User name [default: root]
  -p, --password <PASSWORD>  User password [default: ]
      --host <HOST>          Flight SQL Server host [default: 127.0.0.1]
  -P, --port <PORT>          Flight SQL Server port [default: 4100]
      --tls
      --timeout <TIMEOUT>    Request timeout in seconds [default: 180]
      --prepared             Execute query using prepared statement
      --print-schema         Print resultset schema
      --output <OUTPUT>      Result output format [default: table] [possible values: table, json, csv, tsv, psv]
  -c, --command <COMMAND>    Execute SQL command and exit
  -h, --help                 Print help

Examples

Single command with table output

❯ arrow_cli -h arch -u sundy -p abc --port 8900 --output table --command "select avg(number) from numbers(10);"
+-------------+
| avg(number) |
+-------------+
| 4.5         |
+-------------+

1 rows in set (tickets received in 0.036 sec, rows received in 0.036 sec)

Single command with JSON output

❯ arrow_cli -h arch -u sundy -p abc --port 8900 --output json --command "select number from numbers(3)"
{"number":0}
{"number":1}
{"number":2}

StdIn pipe with CSV output

echo "select number from numbers(3)" | arrow_cli -h arch -u sundy -p abc --port 8900 --output csv
0
1
2

StdIn pipe with TSV output

echo "select number, concat('v', to_string(number)) from numbers(3)" | arrow_cli -h arch -u sundy -p abc --port 8900 --output tsv
0	v0
1	v1
2	v2

Single command with PSV output

❯ arrow_cli -h arch -u sundy -p abc --port 8900 --output psv --command "select number, concat('v', to_string(number)) from numbers(3)"
0|v0
1|v1
2|v2

Interactive session with JSON output

❯ arrow_cli -h arch -u sundy -p abc --port 8900 --output json
Welcome to Arrow CLI v0.4.1.
Connecting to http://arch:8900/ as user sundy.

arch :) select number from numbers(2);

select number from numbers(2);

{"number":0}
{"number":1}

arch :) exit
Bye

Features

  • basic keywords highlight
  • basic auto-completion
  • select query support
  • output formats: table, json, csv, tsv, psv
  • delimited formats use: csv=,, tsv=\t, psv=|
  • TBD

License

Licensed under Apache License, Version 2.0.

About

A Native client talk with server in Flight SQL protocol

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Contributors

Languages

Generated from Xuanwo/formwork