Return

Connecting to Databend and Running Queries with bendsql

March 2, 2023 · 1 min read

Eric

Introducing the CLI tool bendsql


Recently, the Databend team made the CLI tool "bendsql" available to Databend users. The tool was rolled out last year and provided a command-line alternative to connect to Databend Cloud. Now, the team has extended its capabilities by allowing connections to Databend. This post walks you through the installation process and basic commands of bendsql.

Downloading and Installing bendsql

To download and install bendsql, please go to the bendsql repository on GitHub and follow the README instructions.

Connecting to Databend

Use bendsql connect to connect to a Databend instance:

eric@ericdeMacBook rsdoc % bendsql connect -h
Connect to Databend Instance

USAGE
  bendsql connect [flags]

FLAGS
  -d, --database string    (default "default")
  -H, --host string        (default "localhost")
  -p, --password string   
  -P, --port int           (default 8000)
      --ssl               
  -u, --user string        (default "root")

INHERITED FLAGS
  --help   Show help for command

LEARN MORE
  Use 'bendsql <command> <subcommand> --help' for more information about a command.

To connect to a local Databend, simply run bendsql connect:

eric@ericdeMacBook rsdoc % bendsql connect   
Connected to Databend on Host: localhost
Version: DatabendQuery v0.9.58-nightly-790be61(rust-1.68.0-nightly-2023-03-01T16:41:18.376657Z)

Running Queries with bendsql

After connecting bendsql to your Databend instance, you can use bendsql query to run queries with the tool:

eric@ericdeMacBook rsdoc % bendsql query
Connected with driver databend (DatabendQuery v0.9.58-nightly-790be61(rust-1.68.0-nightly-2023-03-01T16:41:18.376657Z))
Type "help" for help.

dd:root@localhost/default=> SELECT NOW();
+------------------------+
|         now()          |
+------------------------+
| 2023-03-02T21:47:10.4Z |
+------------------------+
(1 row)

🎈Connect With Us

Databend is a cutting-edge, open-source cloud-native warehouse built with Rust, designed to handle massive-scale analytics.

Join the Databend Community to try, get help, and contribute!