111 releases (25 breaking)

new 0.26.2 Mar 7, 2025
0.25.6 Feb 8, 2025
0.24.7 Dec 27, 2024
0.23.2 Nov 26, 2024
0.5.0 Jul 28, 2023

#643 in Database interfaces

Download history 8/week @ 2024-11-19 314/week @ 2024-11-26 608/week @ 2024-12-03 238/week @ 2024-12-10 315/week @ 2024-12-17 175/week @ 2024-12-24 95/week @ 2024-12-31 231/week @ 2025-01-07 67/week @ 2025-01-14 404/week @ 2025-01-21 14/week @ 2025-01-28 299/week @ 2025-02-04 50/week @ 2025-02-11 317/week @ 2025-02-18 53/week @ 2025-02-25 185/week @ 2025-03-04

626 downloads per month

Apache-2.0

2MB
6K SLoC

BendSQL

Databend Native Command Line Tool

crates.io License

Install

cargo install bendsql

Usage

❯ bendsql --help
Databend Native Command Line Tool

Usage: bendsql [OPTIONS]

Options:
      --help                 Print help information
      --flight               Using flight sql protocol
      --tls                  Enable TLS
  -h, --host <HOST>          Databend Server host, Default: 127.0.0.1
  -P, --port <PORT>          Databend Server port, Default: 8000
  -u, --user <USER>          Default: root
  -p, --password <PASSWORD>  [env: BENDSQL_PASSWORD=]
  -D, --database <DATABASE>  Database name
      --set <SET>            Settings
      --dsn <DSN>            Data source name [env: BENDSQL_DSN=]
  -n, --non-interactive      Force non-interactive mode
  -q, --query <QUERY>        Query to execute
  -d, --data <DATA>          Data to load, @file or @- for stdin
  -f, --format <FORMAT>      Data format to load [default: csv]
  -o, --output <OUTPUT>      Output format [default: table]
      --progress             Show progress for data loading in stderr
  -V, --version              Print version

REPL

❯ bendsql
Welcome to BendSQL.
Connecting to localhost:8000 as user root.

bendsql> select avg(number) from numbers(10);

SELECT
  avg(number)
FROM
  numbers(10);

┌───────────────────┐
│    avg(number)    │
│ Nullable(Float64) │
├───────────────────┤
│ 4.5               │
└───────────────────┘

1 row in 0.259 sec. Processed 10 rows, 10B (38.59 rows/s, 308B/s)

bendsql> show tables like 'd%';

SHOW TABLES LIKE 'd%';

┌───────────────────┐
│ tables_in_default │
│       String      │
├───────────────────┤
│ data              │
│ data2             │
│ data3             │
│ data4             │
└───────────────────┘

4 rows in 0.106 sec. Processed 0 rows, 0B (0 rows/s, 0B/s)

bendsql> exit
Bye

StdIn Pipe

 echo "select number from numbers(3)" | bendsql -h localhost --port 8900 --flight
0
1
2

Put local files into stage

create stage s_temp;
put fs:///tmp/a*.txt @s_temp/abc;

Generate TPCH/TPCDS datasets

root@localhost:8000/test> gendata(tpch, sf = 0.01, override = 1);

┌─────────────────────────────┐
│   table  │ status │   size  │
│  String  │ String │  UInt64 │
├──────────┼────────┼─────────┤
│ customer │ OK     │  130089 │
│ lineitem │ OK     │ 2551994 │
│ nation   │ OK     │    2195 │
│ orders   │ OK     │  598190 │
│ part     │ OK     │   77400 │
│ partsupp │ OK     │  437252 │
│ region   │ OK     │    1018 │
│ supplier │ OK     │   10653 │
└─────────────────────────────┘

Features

  • basic keywords highlight
  • basic auto-completion
  • select query support
  • TBD

Dependencies

~60–80MB
~1.5M SLoC