Skip to content

tab_separated ​

Description ​

Tab-separated fields, one row per line, with backslash escapes for control characters and the default NULL marker \N.

Input and output. Select it with FORMAT tab_separated. Names ignore ASCII case; use the snake_case name shown here.

Fields use literal tabs as separators and one line per row. Backslash escapes distinguish tabs, line breaks, backslashes and other control data from delimiters. The default NULL text is backslash-N.

This positional format has no names or types header. Use the same field order on import and choose the matching header variant when column identification is needed.

text
SELECT expressions FORMAT tab_separated;
INSERT INTO table [(columns)] [SETTINGS ...] FORMAT tab_separated
<data>

Example usage ​

sql
SELECT CAST(7 AS Int64) AS id, 'Ada' AS name FORMAT tab_separated;
text
7	Ada

Escaping an embedded tab ​

The field contains a tab, but the output represents it with a backslash escape rather than a second field delimiter:

sql
SELECT 'a' || char(9) || 'b' AS label, NULL AS missing
FORMAT tab_separated;
text
a\tb	\N

Format settings ​

Use a statement SETTINGS clause; these options are not persisted by SET.

Setting Type Default Meaning
snappy_mode String basic Read Snappy client files as basic (Hadoop blocks) or framed (standard streaming format).
tab_separated_crlf Bool 0 End each written row with a carriage return and a line feed instead of a line feed.
tab_separated_empty_as_default Bool 0 Give an empty field the column's DEFAULT instead of reading it as empty text.
tab_separated_enum_by_number Bool 0 Read a whole number in an Enum column as the label's number instead of its name.
tab_separated_null_text String \N The field text that stands for NULL when reading and writing; it cannot contain tabs or line breaks.
tab_separated_skip_lines UInt64 0 Ignore this many lines at the start of the input, before any header row.
tab_separated_uneven_rows Bool 0 Accept rows with too few or too many fields: missing fields take the column's DEFAULT and extra fields are dropped.