Skip to content

filimonov/chc

Repository files navigation

Go Report Card

chc

chc: ClickHouse portable command line client.

Just works on Windows / MacOS / Linux / other golang supported platforms.

Install

  1. Download latest release for your platform.
  2. Unpack
  3. Try chc --help

Build

  1. Install go 1.8 (or newer): https://golang.org/doc/install
  2. go get -u github.com/filimonov/chc
  3. chc binary is inside $GOPATH/bin

Features:

  • Progressbar from native client ported
  • Colors / highlights works on Windows
  • Autocompletion for SQL syntax, database names, table names, column names, dictionaries.
  • Pager support
  • Sessions support
  • Reacts on Ctrl+C without delays (native client sometimes have problems with that)
  • Support INTO OUTFILE selects

Currently it works via http interface. Should also work via https (untested).

Should work when readonly = 0 or readonly = 2.

Known issues and limitations

Working via http interface have a certain limitations.

Progress info: HTTP protocol does not have any standard support to send execution progress. Since v1.1.54159 ClickHouse support an option called send_progress_in_http_headers, but in that case server caches the response, and start sending data only then all the data is ready. For command line interface that caching is not always nice (when you run a query and hit Ctrl+C after a while with send_progress_in_http_headers you get nothing in the output). So instead of send_progress_in_http_headers chc sends a lot of requests "SELECT ... FROM system.processes where query_id = ..." in background to get query execution progress. Those small queries will create some extra load, and if you use quotas for queries count then that quota can be exceeded because of those background selects.

Query statistics: Currently there are no option to get query stats after execution. That data can be extracted from query_log but it will make a delay (by default up to 7.5 seconds). So for now only some client-estimated stats are printed after request.

Echo of formatted and parsed query: Currently there is no any option to get formatted query from the server.

Windows: Only terminals with native Windows API for command-line user interaction are supported (so standard windows console / powershell etc). For mintty (Bash on Windows / Cygwin) and other consoles you can try winpty wrapper (untested).

About

chc: ClickHouse portable command line client

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages