{"id":13671588,"url":"https://github.com/databendlabs/bendsql","last_synced_at":"2026-03-15T19:31:03.188Z","repository":{"id":148711133,"uuid":"616438432","full_name":"datafuselabs/bendsql","owner":"datafuselabs","description":"Databend Native Client","archived":false,"fork":false,"pushed_at":"2024-04-12T09:54:15.000Z","size":736,"stargazers_count":42,"open_issues_count":12,"forks_count":19,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-04-12T14:28:27.298Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datafuselabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-03-20T11:48:13.000Z","updated_at":"2024-07-18T10:00:23.886Z","dependencies_parsed_at":null,"dependency_job_id":"e48fec08-ed19-49cd-94a0-b5da2d6bb3fd","html_url":"https://github.com/datafuselabs/bendsql","commit_stats":null,"previous_names":["datafuselabs/databend-client"],"tags_count":77,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datafuselabs%2Fbendsql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datafuselabs%2Fbendsql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datafuselabs%2Fbendsql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datafuselabs%2Fbendsql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datafuselabs","download_url":"https://codeload.github.com/datafuselabs/bendsql/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213463330,"owners_count":15590937,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T09:01:13.968Z","updated_at":"2026-03-15T19:31:03.152Z","avatar_url":"https://github.com/datafuselabs.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# BendSQL\n\nDatabend Native Client in Rust\n\n## Components\n\n- [**core**](core): Databend RestAPI Rust Client\n\n- [**driver**](driver): Databend SQL Client for both RestAPI and FlightSQL in Rust\n\n- [**cli**](cli): Databend Native CLI\n\n### Bindings\n\n- [**python**](bindings/python): Databend Python Client\n\n- [**nodejs**](bindings/nodejs): Databend Node.js Client\n\n- [**java**](bindings/java): Databend Java Client (upcoming)\n\n## Installation for BendSQL\n\n### Installation script\n\n```bash\ncurl -fsSL https://repo.databend.com/install/bendsql.sh | bash\n```\n\nor\n\n```bash\ncurl -fsSL https://repo.databend.com/install/bendsql.sh | bash -s -- -y --prefix /usr/local\n```\n\n### Cargo:\n\n[cargo-binstall](https://github.com/cargo-bins/cargo-binstall) is recommended:\n\n```bash\ncargo binstall bendsql\n```\n\nOr alternatively build from source:\n\n```bash\ncargo install bendsql\n```\n\n### Homebrew:\n\n```bash\nbrew install databendcloud/homebrew-tap/bendsql\n```\n\n### Apt:\n\n- Using DEB822-STYLE format on Ubuntu-22.04/Debian-12 and later:\n\n```bash\nsudo curl -L -o /etc/apt/sources.list.d/databend.sources https://repo.databend.rs/deb/databend.sources\n```\n\n- Using old format on Ubuntu-20.04/Debian-11 and earlier:\n\n```bash\nsudo curl -L -o /usr/share/keyrings/databend-keyring.gpg https://repo.databend.rs/deb/databend.gpg\nsudo curl -L -o /etc/apt/sources.list.d/databend.list https://repo.databend.rs/deb/databend.list\n```\n\nThen install bendsql:\n\n```bash\nsudo apt update\n\nsudo apt install bendsql\n```\n\n### Manually:\n\nCheck for latest version on [GitHub Release](https://github.com/databendlabs/bendsql/releases)\n\n## Usage\n\n```\n❯ bendsql --help\nDatabend Native Command Line Tool\n\nUsage: bendsql [OPTIONS]\n\nOptions:\n      --help                       Print help information\n      --flight                     Using flight sql protocol, ignored when --dsn is set\n      --tls                        Enable TLS, ignored when --dsn is set\n  -h, --host \u003cHOST\u003e                Databend Server host, Default: 127.0.0.1, ignored when --dsn is set\n  -P, --port \u003cPORT\u003e                Databend Server port, Default: 8000, ignored when --dsn is set\n  -u, --user \u003cUSER\u003e                Default: root, overrides username in DSN\n  -p, --password \u003cPASSWORD\u003e        Password, overrides password in DSN [env: BENDSQL_PASSWORD]\n  -r, --role \u003cROLE\u003e                Downgrade role name, overrides role in DSN\n  -D, --database \u003cDATABASE\u003e        Database name, overrides database in DSN\n      --set \u003cSET\u003e                  Settings, overrides settings in DSN\n      --dsn \u003cDSN\u003e                  Data source name [env: BENDSQL_DSN]\n  -n, --non-interactive            Force non-interactive mode\n  -A, --no-auto-complete           Disable loading tables and fields for auto-completion, which offers a quicker start\n      --check                      Check for server status and exit\n      --query=\u003cQUERY\u003e              Query to execute\n  -d, --data \u003cDATA\u003e                Data to load, @file or @- for stdin\n  -f, --format \u003cFORMAT\u003e            Data format to load [default: csv] [possible values: csv, tsv, ndjson, parquet, xml]\n      --format-opt \u003cFORMAT_OPT\u003e    Data format options\n  -o, --output \u003cOUTPUT\u003e            Output format [possible values: table, csv, tsv, null]\n      --quote-style \u003cQUOTE_STYLE\u003e  Output quote style, applies to `csv` and `tsv` output formats [possible values: always, necessary, non-numeric, never]\n      --progress                   Show progress for query execution in stderr, only works with output format `table` and `null`.\n      --stats                      Show stats after query execution in stderr, only works with non-interactive mode.\n      --time[=\u003cTIME\u003e]              Only show execution time without results, will implicitly set output format to `null`. [possible values: local, server]\n  -l, --log-level \u003cLOG_LEVEL\u003e      [default: info]\n  -V, --version                    Print version\n```\n\n## Custom configuration\n\nBy default bendsql will read configuration from `~/.bendsql/config.toml` and `~/.config/bendsql/config.toml`\nsequentially if exists.\n\n- Example file\n\n```\n❯ cat ~/.bendsql/config.toml\n[connection]\nhost = \"127.0.0.1\"\ntls = false\n\n[connection.args]\nconnect_timeout = \"30\"\n\n[settings]\ndisplay_pretty_sql = true\nprogress_color = \"green\"\nno_auto_complete = true\nprompt = \":) \"\n```\n\n- Connection section\n\n| Parameter  | Description                 |\n| ---------- | --------------------------- |\n| `host`     | Server host to connect.     |\n| `port`     | Server port to connect.     |\n| `user`     | User name.                  |\n| `database` | Which database to connect.  |\n| `args`     | Additional connection args. |\n\n- Settings section\n\n| Parameter            | Description                                                                         |\n| -------------------- | ----------------------------------------------------------------------------------- |\n| `display_pretty_sql` | Whether to display SQL queries in a formatted way.                                  |\n| `prompt`             | The prompt to display before asking for input.                                      |\n| `progress_color`     | The color to use for the progress bar.                                              |\n| `show_progress`      | Whether to show a progress bar when executing queries.                              |\n| `show_stats`         | Whether to show statistics after executing queries.                                 |\n| `no_auto_complete`   | Whether to disable loading tables and fields for auto-completion on startup.        |\n| `max_display_rows`   | The maximum number of rows to display in table output format.                       |\n| `max_width`          | Limit display render box max width, 0 means default to the size of the terminal.    |\n| `max_col_width`      | Limit display render each column max width, smaller than 3 means disable the limit. |\n| `output_format`      | The output format to use.                                                           |\n| `expand`             | Expand table format display, default auto, could be on/off/auto.                    |\n| `time`               | Whether to show the time elapsed when executing queries.                            |\n| `multi_line`         | Whether to allow multi-line input.                                                  |\n| `replace_newline`    | whether replace '\\n' with '\\\\\\n'.                                                   |\n\n## Commands in REPL\n\n| Commands       | Description             |\n| -------------- | ----------------------- |\n| `!exit`        | Exit bendsql            |\n| `!quit`        | Exit bendsql            |\n| `!configs`     | Show current settings   |\n| `!set`         | Set settings            |\n| `!source file` | Source file and execute |\n\n## Setting commands in REPL\n\nWe can use `!set CMD_NAME VAL` to update the `Settings` above in runtime, example:\n\n```\n❯ bendsql\n\n:) !set display_pretty_sql false\n:) !set max_display_rows 10\n:) !set expand auto\n```\n\n## DSN\n\nFormat:\n\n```\ndatabend[+flight]://user:[password]@host[:port]/[database][?sslmode=disable][\u0026arg1=value1]\n```\n\nExamples:\n\n- `databend://root:@localhost:8000/?sslmode=disable\u0026presign=detect`\n\n- `databend://user1:password1@tnxxxx--default.gw.aws-us-east-2.default.databend.com:443/benchmark?enable_dphyp=1`\n\n- `databend+flight://root:@localhost:8900/database1?connect_timeout=10`\n\n### Available Args\n\n#### Common\n\n| Arg               | Description                          |\n| ----------------- | ------------------------------------ |\n| `tenant`          | Tenant ID, Databend Cloud only.      |\n| `warehouse`       | Warehouse name, Databend Cloud only. |\n| `sslmode`         | Set to `disable` if not using tls.   |\n| `tls_ca_file`     | Custom root CA certificate path.     |\n| `connect_timeout` | Connect timeout in seconds           |\n\n#### RestAPI Client\n\n| Arg                         | Description                                                                                                                                                      |\n| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `wait_time_secs`            | Request wait time for page, default to `1`                                                                                                                       |\n| `max_rows_in_buffer`        | Max rows for page buffer                                                                                                                                         |\n| `max_rows_per_page`         | Max response rows for a single page                                                                                                                              |\n| `page_request_timeout_secs` | Timeout for a single page request, default to `30`                                                                                                               |\n| `presign`                   | Whether to enable presign for data loading, available arguments are `auto`/`detect`/`on`/`off`. Default to `auto` which only enable presign for `Databend Cloud` |\n\n#### FlightSQL Client\n\n| Arg                         | Description                                                               |\n| --------------------------- | ------------------------------------------------------------------------- |\n| `query_timeout`             | Query timeout seconds                                                     |\n| `tcp_nodelay`               | Default to `true`                                                         |\n| `tcp_keepalive`             | Tcp keepalive seconds, default to `3600`, set to `0` to disable keepalive |\n| `http2_keep_alive_interval` | Keep alive interval in seconds, default to `300`                          |\n| `keep_alive_timeout`        | Keep alive timeout in seconds, default to `20`                            |\n| `keep_alive_while_idle`     | Default to `true`                                                         |\n\n#### Query Settings\n\nsee: [Databend Query Settings](https://databend.rs/doc/sql-commands/show/show-settings)\n\n## Development\n\n### Cargo fmt, clippy, deny\n\n```bash\nmake check\n```\n\n### Unit tests\n\n```bash\nmake test\n```\n\n### integration tests\n\n_Note: Docker and Docker Compose needed_\n\n```bash\nmake integration\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatabendlabs%2Fbendsql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatabendlabs%2Fbendsql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatabendlabs%2Fbendsql/lists"}