# CSV format settings

Delimited-text options control how fields are separated, quoted or escaped, how header names and types bind, and how missing or empty fields are handled.

CSV and TabSeparated have separate setting names. Set the options matching the selected family. A header variant uses its name/type controls; plain positional data still needs the correct destination field order.

Use a statement `SETTINGS` clause. Defaults in `system.settings` are read-only;
format settings cannot be persisted with `SET`. Put input settings before
`FORMAT`, because the bytes after the format name are input data.

## csv_check_types

Type: `Bool`

Default value: `1`

Compare the input types header with the bound target column types; when off, skip that header.

Applies to: `csv_with_names_and_types`.

## csv_crlf

Type: `Bool`

Default value: `0`

End each written row with a carriage return and a line feed instead of a line feed.

Applies to: `csv`, `csv_with_names`, `csv_with_names_and_types`.

## csv_double_quotes

Type: `Bool`

Default value: `1`

Read a field that starts with a double quote as quoted text; when off, the quote is an ordinary character.

Applies to: `csv`, `csv_with_names`, `csv_with_names_and_types`.

## csv_empty_as_default

Type: `Bool`

Default value: `1`

Give an empty unquoted field the column's DEFAULT; when off, read it as empty text.

Applies to: `csv`, `csv_with_names`, `csv_with_names_and_types`.

## csv_enum_by_number

Type: `Bool`

Default value: `0`

Read a whole number in an Enum column as the label's number instead of its name.

Applies to: `csv`, `csv_with_names`, `csv_with_names_and_types`.

## csv_match_names

Type: `Bool`

Default value: `1`

Match input names to target columns ignoring ASCII case; when off, skip the names header and read in target order.

Applies to: `csv_with_names`, `csv_with_names_and_types`.

## csv_null_text

Type: `String`

Default value: `\N`

The unquoted text that stands for NULL when reading and writing; it must stay one untrimmed field under the current CSV settings.

Applies to: `csv`, `csv_with_names`, `csv_with_names_and_types`.

## csv_separator

Type: `Char`

Default value: `,`

The character between fields when reading and writing: one ASCII character that is not a letter, digit, quote, backslash, or line break. Write a tab as \t.

Applies to: `csv`, `csv_with_names`, `csv_with_names_and_types`.

## csv_single_quotes

Type: `Bool`

Default value: `0`

Also read a field that starts with a single quote as quoted text.

Applies to: `csv`, `csv_with_names`, `csv_with_names_and_types`.

## csv_skip_lines

Type: `UInt64`

Default value: `0`

Ignore this many lines at the start of the input, before any header row.

Applies to: `csv`, `csv_with_names`, `csv_with_names_and_types`.

## csv_trim_blanks

Type: `Bool`

Default value: `1`

Drop spaces and tabs around a field when reading; quotes keep the blanks inside them.

Applies to: `csv`, `csv_with_names`, `csv_with_names_and_types`.

## csv_uneven_rows

Type: `Bool`

Default value: `0`

Accept rows with too few or too many fields: missing fields take the column's DEFAULT and extra fields are dropped.

Applies to: `csv`, `csv_with_names`, `csv_with_names_and_types`.
