Skip to main content

Using BendSQL

BendSQL is a command-line tool developed by the Dababend team. With BendSQL, you can establish a connection with Databend Cloud and execute queries directly from a CLI window.

This tool is particularly useful for those who prefer a command line interface and need to work with Databend Cloud on a regular basis. With BendSQL, you can easily and efficiently manage their databases, tables, and data, and perform a wide range of queries and operations with ease.

Installing BendSQL

You can install BendSQL in multiple ways.

Installing BendSQL with brew

If you are a macOS user, you can use brew install to install BendSQL:

brew tap databendcloud/homebrew-tap && brew install bendsql

Installing BendSQL using binary files

Go to the release page for the latest version and download the binary package that is suitable for your platform.

bendsql-darwin-amd64.tar.gzMacOS64-bit AMD
bendsql-darwin-arm64.tar.gzMacOS64-bit ARM
bendsql-linux-amd64.tar.gzLinux64-bit AMD
bendsql-linux-arm64.tar.gzLinux64-bit ARM
bendsql-windows-amd64.tar.gzWindows64-bit AMD

Installing BendSQL with go install

go install

Connecting to Databend Cloud

  1. Log in to Databend Cloud to obtain connection information. The example provided in the connection information offers a bendsql connect command that can be directly used for connecting to Databend Cloud. Copy that command, then move to the next step.

Alt text

  1. Connect to Databend Cloud using the copied bendsql connect command. Here's an example of connecting using the connection information shown in the previous image:
eric@Erics-iMac databend-cloud-platform % bendsql connect -H -P 443 --ssl -u cloudapp -p <your-password> -d db_09_0016

Connected to Databend on Host:
Version: DatabendQuery v1.0.26-nightly-d9b7f4a8080b54d2b4c4a515296ee7557fc135f1(rust-1.70.0-nightly-2023-03-21T04:38:53.365198122Z)

Using BendSQL

Managing Warehouses

BendSQL provides a series of commands to manage your warehouses in Databend Cloud:

bendsql cloud warehouse --help

Operate warehouse. For example:
bendsql cloud warehouse ls
bendsql cloud warehouse status [WAREHOUSE]
bendsql cloud warehouse suspend [WAREHOUSE]

bendsql cloud warehouse [flags]

create: Create a warehouse
delete: Delete a warehouse
ls: show warehouse list
resume: Resume a warehouse
status: show warehouse status
suspend: Suspend a warehouse
use: select working warehouse

--help Show help for command

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

Running SQL Queries

You can use the bendsql query command to enter SQL query mode. In the SQL query mode, you can perform SQL queries just like using any other MySQL client. To exit query mode, please type \q.

bendsql query

Connected with driver databend (DatabendQuery v1.0.26-nightly-d9b7f4a8080b54d2b4c4a515296ee7557fc135f1(rust-1.70.0-nightly-2023-03-21T04:38:53.365198122Z))
Type "help" for help.

# Please input your SQL statement, for example:
=> select * from book_db.databend_books;
| title | author | date |
| Transaction Processing | Jim Gray | 1992 |
| Readings in Database Systems | Michael Stonebraker | 2004 |

More BendSQL Commands

Type bendsql -h to discover more useful commands to make your work easier.

Did this page help you?