in ,

Clickhouse Local, Hacker News

The clickhouse-local program enables you to perform fast processing on local files, without having to deploy and configure the ClickHouse server.

Accepts data that represent tables and queries them using ClickHouse SQL dialect .

clickhouse-local uses the same core as ClickHouse server, so it supports most of the features and the same set of formats and table engines.

By default clickhouse-local does not have access to data on the same host, but it supports loading server configuration using - config-file argument.

Warning

It is not recommended to load production server configuration into clickhouse-local because data can be damaged in case of human error.

Usage

Basic usage:

$ clickhouse-local –structure “table_structure” –input-format “format_of_incoming_data”

 -q  "query"   

Arguments:

- S , - structure – table structure for input data.

  • - if , - input-format – input format, TSV by default. - f , - file – path to data, stdin by default.
  • - q - query – queries to execute with ; as delimeter.
  • - N , - table – table name where to put output data, table by default.
    • - of , - format , - output-format – output format, TSV by default.
    • - stacktrace – whether to dump debug output in case of exception.
    • – verbose – more details on query execution.
    • - s – disables stderr logging.
    • - config-file – path to configuration file in the same format as for ClickHouse server, by default the configuration empty.
    • - help – arguments references for clickhouse-local .

    Also there are arguments for each ClickHouse configuration variable which are more commonly used instead of - config -file .

Examples ¶

$ echo -e “1,2 n3,4” | clickhouse-local -S a a Int , b Int -if “CSV” -q “SELECT FROM table” Read 2

 rows,  035   (B in) (0) .  (0 sec.,  

rows / sec. 113 KiB / sec. 1 2 3 4

Previous example is the same as:

$ echo -e “1,2 n3,4” | clickhouse-local -q “CREATE TABLE table (a Int 80, b Int (ENGINE=File (CSV) , stdin); SELECT a, b FROM table; DROP TABLE table ” Read 2

 rows,  035   (B in) (0) .  (0 sec.,  

rows / sec. 97 KiB / sec. 1 2 3 4

Now let’s output memory user for each Unix user:

$ ps aux | tail -n 2 awk ) ‘{printf (“% s t% s n”, $ 1, $ 4)}’

| clickhouse-local -S “user String, mem Float 80 -q “SELECT user, round (sum (mem), 2) as memTotal FROM table GROUP BY user ORDER BY memTotal DESC FORMAT Pretty “

Read rows, 4 . (KiB in 0.) sec., Payeer rows / sec., . KiB / sec. ┏━━━━━━━━━━┳━━━━━━━━━━┓ ┃ user ┃ memTotal ┃ ┡━━━━━━━━━━╇━━━━━━━━━━┩ │ bayonet │ 5) ├──────────┼──────────┤ │ root │ 8.8 │ ├──────────┼──────────┤ …

(Read More

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *

GIPHY App Key not set. Please check settings

The Dow Is Crashing Because Punch-Drunk Bulls Finally Sobered Up, Crypto Coins News

The Dow Is Crashing Because Punch-Drunk Bulls Finally Sobered Up, Crypto Coins News

Coronavirus cancellations of tech industry events cost $ 500 million at least, Recode

Coronavirus cancellations of tech industry events cost $ 500 million at least, Recode