Skip to content

Formats ​

CoordinatorDB reads rows with INSERT ... FORMAT and writes query results with SELECT ... FORMAT. A format can support input, output, or both. The default output format is pretty_compact.

Format names are case-insensitive. Use the snake_case names listed below; ClickHouse CamelCase names are not aliases.

Formats overview ​

Format Input Output
arrow Yes Yes
arrow_stream Yes Yes
avro Yes Yes
avro_confluent Yes Yes
bson_each_row Yes Yes
csv Yes Yes
csv_with_names Yes Yes
csv_with_names_and_types Yes Yes
custom_separated Yes Yes
custom_separated_with_names Yes Yes
form Yes No
geo_json Yes Yes
hash No Yes
hive_text Yes Yes
json Yes Yes
json_as_object Yes No
json_as_string Yes No
json_columns Yes Yes
json_compact No Yes
json_compact_columns Yes Yes
json_compact_each_row Yes Yes
json_compact_each_row_with_names_and_types Yes Yes
json_compact_strings_each_row Yes Yes
json_each_row Yes Yes
json_object_each_row Yes Yes
json_strings_each_row Yes Yes
line_as_string Yes Yes
markdown No Yes
msg_pack Yes Yes
npy Yes Yes
null_output No Yes
parquet Yes Yes
parquet_metadata Yes No
png No Yes
pretty_compact No Yes
protobuf Yes Yes
regexp Yes No
row_binary Yes Yes
row_binary_with_names Yes Yes
row_binary_with_names_and_types Yes Yes
sql_insert No Yes
sql_values Yes Yes
sqlite Yes Yes
tab_separated Yes Yes
tab_separated_raw Yes Yes
tab_separated_with_names Yes Yes
tab_separated_with_names_and_types Yes Yes
template Yes Yes
tskv Yes Yes
vertical No Yes
xml No Yes
yaml Yes Yes

Use format settings in a statement's SETTINGS clause. These settings apply to one statement and are not persisted by SET. On an INSERT, put SETTINGS before FORMAT: the bytes after the format name are input data.

Reading and writing data ​

Create a destination table:

sql
CREATE TABLE people (id UInt32, name String);

Read two CSV rows in a separate request:

sql
INSERT INTO people FORMAT csv
1,Ada
2,Grace

Write the same rows as one JSON object per line:

sql
SELECT id, name FROM people ORDER BY id FORMAT json_each_row;
text
{"id":1,"name":"Ada"}
{"id":2,"name":"Grace"}

Inline input occupies the rest of its request. Send later SQL in another request. For client files, see the loading guide.

Format schema ​

Schema-bearing containers include Arrow, Parquet, Avro, NumPy, and SQLite. Input values must still satisfy the destination column declarations.

The protobuf format uses the statement settings protobuf_schema and protobuf_message for its inline schema and message name. The avro_confluent format resolves schema identifiers through its configured schema registry. See their format pages for complete examples.

A container schema does not replace an explicit server file() schema except for the input formats that support inference or supply fixed metadata columns. See file schemas.