INSERT using CSV file with single quote in string field cause error

1.3k views Asked by At

INSERT using CSV file with single quote in string field cause error for scenarios like this

"'Catbug' Animated Series In The Works From 'Adventure Time ..."

But other scenarios with single quote loads successfully. Is there a workaround for this issue?

2

There are 2 answers

1
vladimir On BEST ANSWER

Disable to interpret single quote as delimeter by using format_csv_allow_single_quotes-parameter:

echo "'Catbug' Animated Series In The Works From 'Adventure Time ..." |
    clickhouse-client --query "insert into test format CSV" --format_csv_allow_single_quotes 0

echo "'Catbug' Animated Series In The Works From 'Adventure Time ..." |
    clickhouse-client --query "insert into test format CSV settings format_csv_allow_single_quotes=0"
0
Denny Crane On

clickhouse-client --format_csv_allow_single_quotes=0

It because CH does an automatic discovery of used quotes using the first character ' or "