# tab_separated_with_names_and_types

## Description

Escaped tab-separated fields with column names followed by runtime type names.

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

Names and runtime types occupy the first two escaped tab-separated rows. Later rows carry field values in the corresponding order.

The header settings control name matching and type validation. Runtime types can be wider than the original scalar declarations, so choose an import schema compatible with the emitted type row.

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

## Example usage

```sql
SELECT CAST(7 AS Int64) AS id, 'Ada' AS name FORMAT tab_separated_with_names_and_types;
```

```text
id	name
Int64	String
7	Ada
```

## Format settings

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

| Setting                          | Type     | Default | Meaning                                                                                                             |
| -------------------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------- |
| `ignore_unknown_fields`          | `Bool`   | `0`     | Skip input keys and header names that match no target column instead of failing.                                    |
| `snappy_mode`                    | `String` | `basic` | Read Snappy client files as basic (Hadoop blocks) or framed (standard streaming format).                            |
| `tab_separated_check_types`      | `Bool`   | `1`     | Compare the input types header with the bound target column types; when off, skip that header.                      |
| `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_match_names`      | `Bool`   | `1`     | Match input names to target columns ignoring ASCII case; when off, skip the names header and read in target order.  |
| `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. |
