Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inserting String Array through CSV format in ClickHouse db

Tags:

clickhouse

I have a simple table:

CREATE TABLE t1
(
    v1 Int32, 
    a1 Array(Int32), 
    s2 Array(String)
) ENGINE = Memory

but can't figure out how to insert String array:

insert into t1 format CSV 1,"[1,2]","[a1,a2]"

fails with the following error:

Exception on client:
Code: 26. DB::Exception: Cannot parse quoted string: expected opening     quote: 
Could not print diagnostic info because two last rows aren't in    buffer (rare case)
: (at row 1)
like image 242
Kirill Solokhov Avatar asked Sep 06 '16 15:09

Kirill Solokhov


1 Answers

Sorry, re-read documentation and found that Strings in arrays should be wrapped by single quote.

 insert into t1 format CSV 1,"[1,2]","['a1','a2']"
like image 69
Kirill Solokhov Avatar answered Sep 26 '22 08:09

Kirill Solokhov