Skip to content

Commit

Permalink
Fixes in readme / comments
Browse files Browse the repository at this point in the history
  • Loading branch information
filimonov committed Dec 11, 2017
1 parent 931720c commit 2c9b297
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ chc: ClickHouse portable command line client.

Just works on Windows / MacOS / Linux / other [golang supported platforms](https://golang.org/doc/install/source#environment).

## Install
## Install
1. Download latest [release](/~https://github.com/filimonov/chc/releases) for your platform.
1. Unpack
1. Try `chc --help`

## Build
1. Install go 1.8 (or newer): https://golang.org/doc/install
1. Install go 1.8 (or newer): https://golang.org/doc/install
1. `go get -u github.com/filimonov/chc`
1. cd $GOPATH/src/github.com/filimonov/chc && go build
1. chc binary is inside `$GOPATH/bin`

## Features:
* Progressbar from native client ported
* Colors / highlights works on Windows
* Autocompletion for SQL syntax, table names, column names, dictionaries.
* Pager support
* 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)

Expand All @@ -31,8 +31,10 @@ Should work when readonly = 0 or readonly = 2.

Working via http interface have a certain limitations.

*Progress info*: HTTP protocol does not have any standart 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 responce, 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](https://clickhouse.yandex/docs/en/operations/quotas.html) for queries count then that quota can be exceeded because of thouse backgroud selects.
*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](https://clickhouse.yandex/docs/en/operations/quotas.html) 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.
*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](/~https://github.com/rprichard/winpty) wrapper (untested).
2 changes: 1 addition & 1 deletion clickhouse_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func prepareRequest(query, format string, extraSettings map[string]string) (req
return prepareRequestReader(strings.NewReader(query), format, extraSettings)
}

// TODO: context with timeout
func serviceRequestWithExtraSetting(query string, extraSettings map[string]string) (data [][]string, err error) {

timeout := time.Duration(3 * time.Second)
Expand Down Expand Up @@ -97,6 +96,7 @@ func serviceRequest(query string) (data [][]string, err error) {
return serviceRequestWithExtraSetting(query, extraSettings)
}

// TODO: ensure if it was really killed
func killQuery(queryID string) bool {
query := fmt.Sprintf("SELECT 'query_id %s killed by replace'", queryID)
extraSettings := map[string]string{"log_queries": "0", "replace_running_query": "1", "query_id": queryID}
Expand Down

0 comments on commit 2c9b297

Please sign in to comment.