# yaml

## Description

The `yaml` format represents a result as one YAML document containing a sequence
of named mappings. Each mapping is one row, and its keys are column names.

The format supports input and output. Input keys select destination columns by
name, and target declarations validate the values. Missing fields use the
configured defaults. Unknown names raise an error unless
`ignore_unknown_fields = true`.

YAML Core Schema scalars are supported, including strings, numbers, booleans,
and `null`. Quote text that could otherwise be read as a number, boolean, or
missing value. Anchors, aliases, and non-Core tags are rejected. Native array,
tuple, map, and JSON targets validate nested sequences and mappings according
to their declared types.

## Example usage

Create a destination table:

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

Send this input as a separate request:

```sql
INSERT INTO people FORMAT yaml
- id: 1
  name: Ada
- id: 2
  name: Grace
```

Export the rows:

```sql
SELECT id, name FROM people ORDER BY id FORMAT yaml;
```

```text
- "id": 1
  "name": "Ada"
- "id": 2
  "name": "Grace"
```

## Format settings

There are no YAML-specific settings. Set the common
`ignore_unknown_fields` option on an input statement when extra mapping keys
should be skipped:

```text
INSERT INTO people SETTINGS ignore_unknown_fields = true FORMAT yaml
<YAML document>
```
