Skip to content

Native result and input formats ​

The native connection carries requests and results; a SQL FORMAT clause chooses how result rows or attached input are encoded. A row format is not a specification of the native connection's wire framing.

Choose an explicit format ​

sh
./coordinator client --database data --query "SELECT 1 AS id, 'Ada' AS name FORMAT json_each_row"
text
{"id":1,"name":"Ada"}

The client's --query mode writes only result bytes to stdout, including binary output. Capture diagnostics separately when an application consumes stdout as a data stream. Use the snake_case names in the format reference; ClickHouse CamelCase format names are not aliases.

Match input to a schema ​

Select a format that supports input and create the destination table before importing rows. Test nulls, quoted delimiters, empty strings and numeric boundaries with that schema. A schema-bearing container still has to satisfy the destination column declarations.

For client-side files, use the documented batch input options. Keep later SQL in another request when using inline INSERT ... FORMAT, because inline input occupies the remainder of its request. Avoid treating an arbitrary file extension as sufficient evidence of its encoding.