From 7cd01b12a94c88be9ada73d0294c96ceee278278 Mon Sep 17 00:00:00 2001 From: alexey-milovidov Date: Mon, 25 Oct 2021 07:32:57 +0300 Subject: [PATCH 1/2] Add example of using ClickHouse --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index a26f6621..3a7b9e9e 100644 --- a/README.md +++ b/README.md @@ -171,6 +171,17 @@ Invoke-WebRequest 'https://storage.googleapis.com/covid19-open-data/v3/latest/ep where key -eq 'AU' | select date,cumulative_confirmed,cumulative_deceased,cumulative_recovered ``` +### ClickHouse +You can load data into ClickHouse with the following query: +``` +CREATE TABLE covid ENGINE = MergeTree ORDER BY (location_key, date) + AS SELECT * FROM url('https://storage.googleapis.com/covid19-open-data/v3/epidemiology.csv', CSVWithNames, + 'date Date, location_key LowCardinality(String), new_confirmed Int32, new_deceased Int32, new_recovered Int32, new_tested Int32, cumulative_confirmed Int32, cumulative_deceased Int32, cumulative_recovered Int32, cumulative_tested Int32') +``` +You can also process it directly with `clickhouse-local`: +``` +clickhouse-local --input-format CSVWithNames --structure 'date Date, location_key String, new_confirmed Int32, new_deceased Int32, new_recovered Int32, new_tested Int32, cumulative_confirmed Int32, cumulative_deceased Int32, cumulative_recovered Int32, cumulative_tested Int32' --query "SELECT * FROM table" < epidemiology.csv +``` ## Understand the data From cb95435935d03150386a3796b44554e323c80152 Mon Sep 17 00:00:00 2001 From: alexey-milovidov Date: Mon, 25 Oct 2021 07:37:06 +0300 Subject: [PATCH 2/2] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3a7b9e9e..5f027765 100644 --- a/README.md +++ b/README.md @@ -173,13 +173,13 @@ Invoke-WebRequest 'https://storage.googleapis.com/covid19-open-data/v3/latest/ep ### ClickHouse You can load data into ClickHouse with the following query: -``` +```sql CREATE TABLE covid ENGINE = MergeTree ORDER BY (location_key, date) AS SELECT * FROM url('https://storage.googleapis.com/covid19-open-data/v3/epidemiology.csv', CSVWithNames, 'date Date, location_key LowCardinality(String), new_confirmed Int32, new_deceased Int32, new_recovered Int32, new_tested Int32, cumulative_confirmed Int32, cumulative_deceased Int32, cumulative_recovered Int32, cumulative_tested Int32') ``` You can also process it directly with `clickhouse-local`: -``` +```bash clickhouse-local --input-format CSVWithNames --structure 'date Date, location_key String, new_confirmed Int32, new_deceased Int32, new_recovered Int32, new_tested Int32, cumulative_confirmed Int32, cumulative_deceased Int32, cumulative_recovered Int32, cumulative_tested Int32' --query "SELECT * FROM table" < epidemiology.csv ```