Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Add example of using ClickHouse #514

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
```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
```


## Understand the data
Expand Down