9951 explained code solutions for 126 technologies


clickhouseUsing Template format to insert data in custom format


echo 'My name is ${col:CSV} and I am ${age:CSV}' > tmp.tpl
echo 'My name is Donald and I am 125' | clickhouse-client -q "INSERT INTO tbl FORMAT Template SETTINGS format_template_row = 'tmp.tpl'"ctrl + c
tmp.tpl

save custom format description to the temporary file

${col:CSV}

placeholder to pick value for col column, escaped using CSV rules (more details)

${age:CSV}

placeholder to pick value for age column

My name is Donald and I am 125

example string to insert using custom format

clickhouse-client -q

execute given query through client interface

INSERT INTO tbl

insert given data into tbl table

FORMAT Template

use Template format

format_template_row

set path to our template format file