# Config reference

> This document describes the Floe YAML configuration format and the meaning of all supported options. See example/config.yml for a full working example.

Source: https://openlakeforge.dev/floe/reference/config/

This document describes the Floe YAML configuration format and the meaning of
all supported options. See `example/config.yml` for a full working example.

## Structure at a glance

```yaml
version: "0.8"
metadata: { ... }
report:
  path: "/abs/or/relative/report/dir"
  storage: "s3_raw"
env:
  file: "metadata/env.dev.yml"
  vars:
    incoming_path: "/data/incoming"
domains:
  - name: "sales"
    incoming_dir: "{{incoming_path}}/sales"
entities:
  - name: "customer"
    domain: "sales"
    metadata: { ... }
    incremental_mode: "file"
    state:
      path: "./state/customer.json"
    source:
      format: "csv"
      path: "{{domain.incoming_dir}}/customer"
      options:
        header: true
        separator: ","
        encoding: "utf-8"
        null_values: ["", "NULL", "null"]
        recursive: false
        glob: "*.csv"
      cast_mode: "strict"
    sink:
      accepted:
        format: "parquet"
        path: "/path/to/accepted/"
      rejected:
        format: "csv"
        path: "/path/to/rejected/"
      archive:
        path: "/path/to/archive/"
    policy:
      severity: "reject"
    schema:
      normalize_columns:
        enabled: true
        strategy: "snake_case"
      schema_evolution:
        mode: "strict"
        on_incompatible: "fail"
      unique_keys: [["customer_id"]]
      columns:
        - name: "customer_id"
          type: "string"
          nullable: false
```

## Top-level fields

- `version` (required)
  - The minimum Floe release the config targets, as a numeric `major.minor`
    string such as `"0.8"`.
  - Floe accepts any version from `"0.1"` up to its own release (`"0.8"`) and
    rejects a newer one. Older versions keep their semantics.
  - `schema.schema_evolution` requires `version >= "0.2"`.
  - `version >= "0.3"` qualifies entity identity with its domain (see Entity identity).
- `metadata` (optional)
  - Free-form project metadata. Keys supported in schema: `project`,
    `description`, `owner`, `tags`.
- `report` (optional)
  - `report.path` is the base directory where run reports are written. If omitted,
    defaults to `"report"`.
  - `report.storage` (optional) selects the storage client used for reports.
    Defaults to `storages.default` when defined, otherwise `local`.
  - When `report.storage` is cloud-based, reports are written via temp upload.
    Relative `report.path` values resolve under the storage prefix.
  - Reports are written under:
    `report.path/run_<run_id>/run.summary.json` and
    `report.path/run_<run_id>/<entity.name>/run.json`; a single-domain run goes under
    `report.path/<domain>/run_<run_id>/` (D37, see [report](https://openlakeforge.dev/floe/reference/report/)).
  - A profile's `report:` block can fix the storage and a prefix; `report.path` then nests under
    that prefix and must be relative, without `..` (see
    [profiles](https://openlakeforge.dev/floe/guides/profiles/#fixing-where-run-reports-go)).
  - Supports `{{var}}` templating (see "Templating & domains").
- `storages` (optional)
  - Defines named storage clients for `source.storage` and `sink.*.storage`.
  - If omitted, `local` is assumed.
  - Types: `local`, `s3`, `adls` and `gcs`. The `adls` and `gcs` types need the `adls` or `gcs`
    extra (`pip install 'floe-python[adls]'`); credentials come from the environment.
    - `s3`: `bucket` and `region` (required), `prefix`, `endpoint`, `path_style_access`. See [S3](https://openlakeforge.dev/floe/storages/s3/).
    - `adls`: `account` and `container` (required), `prefix`, `endpoint` (an Azurite-style service).
      URIs are `abfss://<container>@<account>.dfs.core.windows.net/...`. See [ADLS](https://openlakeforge.dev/floe/storages/adls/).
    - `gcs`: `bucket` (required), `prefix`, `endpoint` (a fake-gcs-server-style service).
      URIs are `gs://<bucket>/...`. See [GCS](https://openlakeforge.dev/floe/storages/gcs/).
  - `floe maintain` and `floe manifest generate`/`replay` refuse a config that defines any `adls` or
    `gcs` storage, even an unused one.
  - Iceberg sinks and `warehouse_storage` accept `s3` and `gcs` storage, not `adls`. Delta is
    refused on `adls` and `gcs`.
- `catalogs` (optional)
  - Defines named Iceberg REST catalogs (Polaris, Nessie, Snowflake Open Catalog, etc.).
    An Iceberg accepted sink requires one (D26).
  - Supported types: `rest` and `glue` (AWS Glue, restored in 0.8.1). `unity` was dropped in 0.8
    (D1) and fails validation; the archived [OpenLakeForge/floe-rust](https://github.com/OpenLakeForge/floe-rust) documents them for 0.7.
  - Keys:
    - `default` (optional): default catalog name used by `sink.accepted.iceberg.catalog` when omitted.
    - `definitions` (required): array of catalog definitions.
      - `name` (required)
      - `type` (required): `rest`
      - `uri` (required): REST catalog base URI
      - `credential` (optional): `token:<pat>` or `client_credentials:<id>:<secret>`; `${ENV_VAR}` placeholders are resolved from the OS environment at run time, so manifest runs can keep REST catalog secrets out of the manifest artifact
      - `warehouse` (optional): warehouse/prefix hint forwarded to the REST catalog
      - `oauth2_server_uri` (optional): override OAuth2 server URL for client-credentials flow
      - `scope` (optional): OAuth2 scope
      - `warehouse_storage` (optional): storage name for table location resolution; must be an S3 or GCS storage
      - `warehouse_prefix` (optional): prefix for deterministic table locations
    - Glue definitions (`type: glue`) take `name`, `region` (required), `database` (required:
      the Glue database that holds the tables; `{domain}` expands per entity to its
      `sink.accepted.iceberg.namespace` or `domain`), `create_database_if_missing` (optional, default
      `true`), `warehouse_storage` (must be an S3 storage) and `warehouse_prefix`. Glue supports
      `overwrite` and `append`; merges need a REST catalog. See [Iceberg sink](https://openlakeforge.dev/floe/sinks/iceberg/).
- `lineage` (optional)
  - Enables OpenLineage event emission for this run.
  - `url` (required): base URL of the OpenLineage-compatible endpoint (e.g. `http://marquez:5000`)
  - `endpoint` (optional, default `api/v1/lineage`): path joined to `url` for POST requests
  - `namespace` (required): OpenLineage namespace for job identity
  - `dataset_namespace` (optional, defaults to `namespace`): namespace for accepted Iceberg output datasets
  - `api_key` (optional): Bearer token; supports `{{VAR}}` placeholder expansion
  - `timeout_secs` (optional, default `5`): HTTP request timeout in seconds
  - `producer` (optional): URI identifying this producer
  - See [OpenLineage integration](https://openlakeforge.dev/floe/guides/lineage/) for full event reference and lifecycle details.
- `env` (optional)
  - Enables variable templating for string fields using `{{var}}` syntax.
  - `env.file` (optional) loads variables from a YAML file (path relative to the
    main config file).
  - `env.vars` (optional) provides inline variables and overrides `env.file`.
- `domains` (optional)
  - Named domain roots that can be referenced by entities via `entity.domain`.
  - Example entry: `{ name: "sales", incoming_dir: "{{incoming_path}}/sales" }`.
  - `incoming_dir` is required in config version 0.2 and optional from 0.3. The
    `{{domain.incoming_dir}}` template is unavailable when it is omitted.
  - `defaults` (optional, requires `version: "0.3"`): entity fields merged into
    every entity whose `domain` matches, before parsing. The entity wins; maps
    merge key by key; lists are replaced, not appended. `schema.columns` and
    `schema.primary_key` are never inherited. See [Merge rules](#merge-rules).
- `sources` (optional, requires `version: "0.3"`)
  - Named, reusable entity `source` blocks: each entry is `name` plus any
    `source` fields (`format`, `path`, `storage`, `options`, `cast_mode`).
  - A project may load these entries from one `sources.yml` file with
    `include.sources`, relative to the main config file. The file has a top-level
    `sources: [...]` array; inline `sources` and `include.sources` cannot be combined.
  - An entity uses one with `source: { ref: <name>, resource: <resource> }`.
    Other fields set on the entity's `source` override the referenced source
    (maps merge key by key, as for domain `defaults`). Domain `defaults` apply
    beneath the resolved source: entity, then source, then domain defaults.
  - `{{resource}}` in the source `path` resolves to `source.resource`, which
    defaults to the entity `name`.
  - An unknown `ref` is an error listing the declared sources.
- `include` (optional, requires `version: "0.3"`)
  - `include.sources`: path to one file containing a top-level `sources: [...]`
    array. It resolves relative to the main config file.
  - `include.domains`: glob patterns, relative to the main config file, each
    matching a domain file (e.g. `["silver/*/_domain.yml"]`). A domain file holds
    one `domains` entry; every sibling `*.yml` file holds one entity of that
    domain. An entity file may omit `domain`; if set, it must match the domain
    file's `name`. Included domains and entities are appended after the inline
    `domains` and `entities`, so `entities` may be omitted.
  - A domain file may set `entities`, a glob relative to the domain file (e.g.
    `entities: "contracts/*.yml"`). Its matches replace the sibling files as the
    domain's entity files; the domain file itself is never loaded as an entity.
    Only an included domain file may set it.
  - A pattern that matches no file is an error, in `include.domains` and in a
    domain file's `entities`. Includes resolve against local
    files only, so a remote (`s3://`, ...) config cannot use them.
- `entities` (required)
  - Array of entity definitions (datasets). A single CLI run may process
    multiple entities.

## Merge rules

An entity's final definition is merged in two steps before it is parsed, so
every inherited value is validated like an inline one:

1. the entity's own `source` fields are overlaid on the referenced source;
2. the resulting entity is overlaid on its domain's `defaults`.

| Case | Rule |
|---|---|
| Precedence | entity > referenced source > domain `defaults` |
| Maps (`sink`, `sink.accepted`, `source.options`, `policy`, ...) | Merged key by key, at every depth |
| Scalars | The higher layer's value replaces the lower one |
| Lists (`source.options.null_values`, `schema.unique_keys`, `pii.columns`, ...) | The higher layer's list replaces the lower one; lists are never appended |
| `schema.columns`, `schema.primary_key` in `defaults` | Dropped; never inherited. Other `schema` keys (`normalize_columns`, `schema_evolution`, `unique_keys`, `checks`) are |
| `source.ref` | Set on the entity or in domain `defaults.source`; the entity's wins. Removed before merging |
| `source.resource` | Read from the entity's `source` only and removed before merging; in domain `defaults` it is an unknown field |
| `{{resource}}` | Replaced in the merged `source.path` with `source.resource`, or the entity `name` when omitted, with or without a named source |

Example: with `sources: [{ name: csv_drop, format: csv, path: "./in/{{resource}}.csv", options: { header: true, separator: "," } }]`,
an entity `source: { ref: csv_drop, options: { separator: ";" } }` named
`orders` reads `./in/orders.csv` with `header: true` and `separator: ";"`.

## Entity fields

### `name` (required)
Logical dataset name. Used in report and output paths.

### `metadata` (optional)
Free-form entity metadata. Supported keys: `data_product`, `domain`, `owner`,
`description`, `tags`.

### `domain` (optional)
Reference to a domain defined in `domains`. When set, `{{domain.incoming_dir}}`
is available for templating within that entity.

### `runner` (optional)

Select a runner declared in the environment profile. A domain can set `runner`
for its entities; an entity value takes precedence. When neither sets it, the
profile default is used. Validation rejects an undeclared name.

### Entity identity
With `version >= "0.3"`, an entity with a `domain` is identified as `<domain>.<name>`;
otherwise (and in all `0.1`/`0.2` configs) its identity is the bare `name`.

- Ids must be unique, so the same `name` may exist in different domains.
  In `0.3`, `name` and `domain` must be non-empty and must not contain `.`, `/` or `\`.
- The id is used for report paths (`run_<id>/<domain>/<name>/run.json`), run summary
  and report entity names, the default incremental state dir (`.floe/state/<domain>/<name>/`),
  manifest `entities[].name`, and OpenLineage job names.
  Manifest `asset_key` stays `[domain, name]`.
- `--entities` accepts ids, or bare names when they match a single entity; an ambiguous
  bare name fails and lists the qualified candidates. `floe state` takes the same selectors,
  and `add-entity` treats the same name in another domain as a new entity.

### `incremental_mode` (optional)

- Controls incremental ingestion behavior for the entity.
- Supported values:
  - `none` (default)
  - `archive`
  - `file`
  - `row` was never implemented and is refused: `incremental_mode: row` fails validation.
- `incremental_mode: archive` requires `sink.archive`.
- `incremental_mode: file` enables per-file state tracking and skip logic.
- For backward compatibility, `sink.archive` without `incremental_mode` is still
  treated as archive mode, but new configs should set `incremental_mode: archive`
  explicitly.

### `state` (optional)

- Entity-local state settings used by incremental ingestion.
- `state.path` (optional)
  - Overrides the file or object used to store entity state.
  - Supports local paths and URIs on the source storage (`s3://`, `abfss://`, `gs://`).
  - Relative paths always resolve as local filesystem paths, regardless of the source
    storage context. Only explicit URIs use remote storage. A relative override with a cloud source will produce local state and will
    not benefit from remote claim coordination.
  - If omitted and `incremental_mode: file` is used, Floe derives the path under the
    source root as `.floe/state/<entity>/state.json`.
  - For cloud sources, the derived default is a remote object under the source root,
    for example `s3://bucket/prefix/incoming/.floe/state/customer/state.json`.

#### File incremental state and concurrency

`incremental_mode: file` writes state using schema `floe.state.file-ingest.v2`.
Existing `floe.state.file-ingest.v1` files are still readable; Floe rewrites state
as v2 the next time it updates the entity.

The durable `files` map tracks file URIs that have completed successfully. The
`claims` map tracks files currently owned by a run, with `run_id`, acquisition
time, expiry time, size, and mtime. The default claim TTL is one hour.

Before processing, Floe removes expired claims, skips previously processed files,
and skips files actively claimed by another run with an incremental warning in
the report. New pending files are claimed with an optimistic conditional state
write before accepted sink output is written. On success, the run promotes its
claims into `files`; on entity failure, it removes its claims so the files can be
retried. Conditional write conflicts are retried a small fixed number of times
and then fail with a clear concurrency error.

Remote state requires object-store permissions to read, write with conditional
preconditions, and delete the state object. Normal source listing permissions are
still needed for input discovery; state itself does not require listing except
where the selected cloud provider or IAM policy requires it for object access.

See [Incremental File Ingestion](https://openlakeforge.dev/floe/concepts/incremental/) for examples, CLI operations,
state file shape, and CAS behavior.

### `source` (required)

- `format` (required)
  - Supported: `csv`, `tsv`, `parquet`, `orc`, `json`, `xlsx`, `avro`, and `xml`.
    `fixed` (fixed-width) was dropped in 0.8 (D1) and fails validation.
  - S3 inputs use temp download + local read.
  - `json` supports NDJSON and JSON array modes.
  - `tsv` uses tab-delimited parsing (same options as `csv`).
  - `xlsx` reads Excel worksheets using `source.options.sheet` + row offsets.
  - `xml` reads repeated records using `source.options.row_tag`.
- `path` (required)
  - Input location. Can be a file, a directory, or a glob pattern
    (example: `/data/in/*.csv`).
  - If a directory is provided, a glob is applied to select files.
  - Relative paths resolve against the config file directory.
  - Supports `{{var}}` templating (see "Templating & domains").
- `storage` (optional)
  - Name of the storage client to use for this source.
  - Defaults to `storages.default` when defined, otherwise `local`.
- `options` (optional)
  - Format-specific options.
  - Defaults if omitted:
    - `header`: `true`
    - `separator`: `";"` (or `"\t"` when `source.format` is `tsv`)
    - `encoding`: `"UTF8"`
    - `null_values`: `[""]` (empty fields treated as null by default)
    - `recursive`: `false`
    - `glob`: (none; default is based on `source.format`)
    - `json_mode`: `"array"`
  - `glob` (optional)
    - Used only when `source.path` is a directory.
    - Overrides the default file pattern for the source format:
      - `csv`: `*.csv`
      - `tsv`: `*.tsv`
      - `parquet`: `*.parquet`
      - `orc`: `*.orc`
      - `json`: `*.json`
      - `xlsx`: `*.xlsx`
      - `avro`: `*.avro`
      - `xml`: `*.xml`
    - If `source.path` itself contains a glob pattern, this option is ignored.
  - `recursive` (optional)
    - If `true`, directory globs include subdirectories (via `**/`).
  - `json_mode` (optional)
    - `array` (default): JSON array ingestion when `source.format: json`.
    - `ndjson`: newline-delimited JSON ingestion.
    - Nested JSON is supported via `schema.columns[].source` selectors.
    - JSON schema mismatch checks only consider top-level selector sources (no `.` or `[`).
    - For safety, JSON configs are limited to 1024 columns per entity.
  - `row_tag` (required, `source.format: xml`)
    - Element name used as row boundary (each matching element becomes one record).
  - `namespace` (optional, `source.format: xml`)
    - Namespace URI used to match `row_tag` and selector element tokens.
  - `value_tag` (optional, `source.format: xml`)
    - Optional descendant element used when extracting text content from selector targets.
  - `sheet` (optional, `source.format: xlsx`)
    - Sheet name to read (defaults to first sheet).
  - `header_row` (optional, `source.format: xlsx`)
    - 1-based row index for column headers (default: 1).
  - `data_row` (optional, `source.format: xlsx`)
    - 1-based row index where data starts (default: `header_row + 1`).
- `cast_mode` (optional)
  - `strict` (default): invalid values produce cast errors.
  - `coerce`: invalid values become null (and may still fail `not_null`).
- `partitioning` (optional, D28)
  - For raw layouts such as `<source>/yyyy/MM/dd/<batch>/files`:
    ```yaml
    source:
      path: s3://raw/crm/customer/
      partitioning:
        pattern: "{yyyy}/{MM}/{dd}/{batch}"   # or "year={yyyy}/month={MM}/day={dd}"
        date_column: ingest_date               # required
        batch_column: batch_id                 # optional
        lookback_days: 1                       # optional, file mode (D30)
    ```
  - `pattern` is matched against each input's directory, relative to the source root (the
    part of `path` before any glob). The match is on the whole directory; the file name is free.
    Tokens are `{yyyy}`, `{MM}` and `{dd}` (required), `{HH}` (optional) and `{batch}`
    (optional, one folder name, such as a hash). Other text is literal.
  - Every row gets `date_column`, a `date`, or a `datetime` when the pattern has `{HH}`. With
    `batch_column`, it also gets the `{batch}` folder name as a `string`. Both are ordinary columns
    for keys, merges and `partition_spec` (for example `{column: ingest_date, transform: day}`).
    They must not also be in `schema.columns`, before or after `normalize_columns`. A file column
    with the same name is an extra column, handled by `schema.mismatch.extra_columns`; the value
    from the path is what is kept.
  - Inputs are listed recursively, whatever `options.recursive` says. They load by date, then by
    batch (earliest file modification time first, then name), then by file name.
    `resolved_inputs` in the report lists them in that order.
  - A listed file whose directory doesn't match, or whose date is invalid (month 13), fails the
    run before any entity starts. The error names the file and the pattern.
  - In archive mode, an input is archived under its partition path:
    `<archive>/<entity>/yyyy/MM/dd/<batch>/<stem>__run-…__src-….<ext>` (D29). A `--full-refresh`
    reads the archive recursively and derives the same date and batch from those paths.
    On object stores (S3), each run also writes one index, `<archive>/<entity>/.floe/source_mtime/<run_id>.json`,
    before it archives: a JSON object from each archived file's path under `<entity>/` to the source's modification
    time. A full refresh merges the indexes to order same-day batches (#939, #1271), since the copy's own time is its
    archive time. Archives from before the index keep the time in the copy's object metadata `floe-source-mtime`,
    which is still read for a file the indexes do not list. A local archive has no index: the copy's own nanosecond
    modification time already follows the load order.
  - With `incremental_mode: file` (D30), the state also keeps a **watermark**: the latest
    partition date ingested. A run lists only from `watermark - lookback_days` (default `1`): S3
    starts the listing after the previous day's prefix, a local source skips older directories. Inside
    that window the per-file state still decides, so a new batch on the same day is picked up.
    Any claim still in the state holds the window back to its date, so a crashed run's files are
    retried. The window needs the date at the front of `pattern` (`{yyyy}`, `{MM}`, `{dd}`, no
    `{batch}` or `{HH}` before `{dd}`); with another pattern the whole source is listed and older
    files are dropped after listing.
  - A file landing in a day older than the window is not ingested. Floe can't see it (it is not
    listed), so every run that lists from a watermark logs one warning naming the window. A
    `--full-refresh` lists everything and picks it up.
  - The watermark moves only forward, when a run promotes its files, in the same state write. A
    failed `--full-refresh` clears it. If it failed before writing to the sink, it also puts back
    the claims it replaced (of dead or still running runs), so those files are retried.
  - Per-file entries older than the window are pruned in the same state write, and the state
    records the cut as `pruned_before`. It moves only forward, never past a claim's date, and no
    normal run lists a date before it, even after raising `lookback_days` or a failed `--full-refresh`;
    only a `--full-refresh` does. So the state no longer grows with every file ingested.

### `sink` (required)

- `write_mode` (optional)
  - `overwrite` (default): remove existing dataset parts, then write new ones.
  - `append`: add new dataset parts without deleting existing ones.
  - `merge_scd1`: upsert mode keyed by `schema.primary_key` for Iceberg accepted sinks (D2).
    - updates matching keys (SCD1) and inserts new keys
    - requires `sink.accepted.format: iceberg`
    - requires non-empty `schema.primary_key`
    - optional merge behavior can be configured in `sink.accepted.merge`
    - source rows must be unique on `schema.primary_key`: duplicates of the key are rejected before the merge, even under `policy.severity: warn`
  - `merge_scd2`: history mode keyed by `schema.primary_key`.
    - closes changed current rows and inserts new current versions
    - requires `sink.accepted.format: iceberg`; the table carries the SCD2 system columns
      (`sink.accepted.merge.scd2`), and the report adds `closed_count` and `unchanged_count`
    - requires non-empty `schema.primary_key`
    - optional merge behavior can be configured in `sink.accepted.merge`
    - source rows must be unique on `schema.primary_key`: duplicates of the key are rejected before the merge, even under `policy.severity: warn`
  - Applies to the accepted sink only. Rejected CSV, Parquet and Iceberg output always appends, whatever `write_mode` is.
- `accepted` (required)
  - `format`: `parquet`, `iceberg` or `delta`.
    - `iceberg`: Iceberg table in a REST catalog; `sink.accepted.iceberg` with a catalog is required (0.8). See [Iceberg sink](https://openlakeforge.dev/floe/sinks/iceberg/).
    - `delta`: path-based Delta table on local or S3 storage; `write_mode` `overwrite` or `append`; needs the `delta` extra. `sink.accepted.delta` with a `type: unity` catalog registers the table in Unity Catalog (S3 storage; tested against a stub only). See [Delta sink](https://openlakeforge.dev/floe/sinks/delta/).
    - `duckdb` was dropped in 0.8 (D1) and fails validation; the archived
      [OpenLakeForge/floe-rust](https://github.com/OpenLakeForge/floe-rust) documents it for 0.7.
- `path`: output directory for accepted records.
  - Supports `{{var}}` templating (see "Templating & domains").
  - `storage` (optional)
    - Name of the storage client to use for this sink target.
    - Defaults to `storages.default` when defined, otherwise `local`.
  - `options` (optional)
    - Sink tuning options (format support varies).
    - `compression`: `snappy`, `gzip`, `zstd`, `uncompressed`
    - `row_group_size`: positive integer (rows per row group)
    - `max_size_per_file`: positive integer bytes (default: 256MB)
      - Parquet: split accepted parquet into parts at write time.
      - Iceberg: only sets the report's small-file threshold (half this value).
    - Iceberg applies `compression` and `row_group_size` to `overwrite`/`append` data files only (not merges); see [Iceberg sink](https://openlakeforge.dev/floe/sinks/iceberg/).
    - Accepted rows are written once per entity, after every input file is read: Parquet
      parts in one pass, Iceberg in one catalog commit. Inputs are archived (when
      `sink.archive` is enabled) only after that write succeeds, so an input is never
      archived unless its rows were written; if the write fails, the inputs stay in the source.
  - `partition_by` (optional, `sink.accepted.format: delta`): identity partition columns, set when the table is created. An existing table partitioned by other columns fails the run with `run_schema_evolution`. Other formats: `floe validate` rejects it. See [Delta sink](https://openlakeforge.dev/floe/sinks/delta/).
  - `partition_spec` (optional, `sink.accepted.format: iceberg`)
    - Array of partition spec entries.
    - Each entry supports:
      - `column` (required): schema column name
      - `transform` (optional, default `identity`): `identity`, `year`, `month`, `day`, `hour`, `bucket` (D12)
      - `num_buckets` (required with `transform: bucket`, positive; not allowed otherwise)
    - `floe validate` checks column existence and supported transforms.
    - Runtime wiring is implemented for Iceberg accepted writes (table partition spec + partitioned file layout).
  - `merge` (optional, merge modes only)
    - Supported only when:
      - `sink.accepted.format: iceberg`
      - `sink.write_mode: merge_scd1` or `merge_scd2`
    - `ignore_columns` (optional)
      - List of schema business columns excluded from merge update/compare behavior.
      - Columns must exist in `schema.columns`.
      - `schema.primary_key` columns are not allowed.
    - `compare_columns` (optional; `merge_scd2` only: `merge_scd1` has no change detection and refuses it)
      - Explicit list of schema business columns used for change detection.
      - Columns must exist in `schema.columns`.
      - `schema.primary_key` columns are not allowed.
      - If omitted in `merge_scd2`, Floe compares all non-key business columns minus `ignore_columns`.
    - `scd2` (optional, `merge_scd2` only)
      - `current_flag_column` (default `__floe_is_current`)
      - `valid_from_column` (default `__floe_valid_from`)
      - `valid_to_column` (default `__floe_valid_to`)
      - Custom names must be non-empty, unique, and must not collide with business schema columns.
  - `iceberg` (required for `sink.accepted.format: iceberg` in 0.8)
    - Binds the sink to its REST catalog; a catalog-less Iceberg sink is rejected by `floe validate`.
    - `catalog` (optional)
      - Catalog name from `catalogs.definitions` (type `rest`).
      - If omitted, `catalogs.default` is used when set.
    - `namespace` (optional)
      - Iceberg namespace; created in the catalog if missing.
      - Defaults to `entity.domain` when present, otherwise `default`.
    - `table` (optional)
      - Logical table name for the catalog registration.
      - Defaults to `entity.name` (normalized).
    - `location` (optional)
      - Overrides the Iceberg table root location.
      - Resolved via `warehouse_storage` when defined, otherwise via the sink storage.
      - Without it, the location is `<warehouse_prefix>/<namespace>/<table>` when the catalog sets
        `warehouse_storage` or `warehouse_prefix`, otherwise `sink.accepted.path`.
  - Accepted output reports may include file sizing metrics (`files_written`,
    `total_bytes_written`, `avg_file_size_mb`, `small_files_count`) when collected by the writer.
    - Parquet: populated from written parquet files.
    - Iceberg: populated from written Iceberg data files (metadata/manifests excluded from size totals).
  - `table_version` in reports is the Iceberg metadata version or the Delta table version; `snapshot_id` is Iceberg-only.
  - Floe does not maintain tables during `floe run`. Iceberg snapshot expiry, orphan-file
    removal and (experimental) compaction run separately with `floe maintain` (see [CLI](https://openlakeforge.dev/floe/reference/cli/)).
  - `schema.schema_evolution` is strict by default.
    - Runtime support is Iceberg-only and additive-only (D13).
    - `mode: add_columns` adds new source columns to the Iceberg table as nullable columns.
    - Unsupported changes such as drops, renames, type changes, and non-nullable-to-nullable drift still fail the write.
    - The columns are added, but 0.8 does not report it yet: the entity report's `schema_evolution` block stays `applied: false` and no `schema_evolution_applied` event is emitted (#994).
- `rejected` (required when `policy.severity` is `reject` or `abort`; D39)
  - `format`: `csv` (default), `parquet` or `iceberg`.
  - The `__floe_*` columns of each format and the `__floe_errors` format are a versioned contract: see
    [Rejected row envelope](https://openlakeforge.dev/floe/reference/rejected/).
- `path`: output directory for rejected rows.
  - Supports `{{var}}` templating (see "Templating & domains").
  - Rejected outputs are written as dataset parts (`part-*.csv` or `part-*.parquet`).
  - With a Parquet accepted sink, `sink.accepted.path` must differ from `sink.rejected.path`, whatever the rejected
    format: `reject_file` and `abort` copy the raw file to `<path>/<file>`, and the accepted Parquet writer would
    overwrite or delete a copy named `part-*.parquet` there. `floe run` refuses the config.
  - Parquet output contract (the rows go to `<path>/rows/part-*.parquet`, apart from the raw file copies and error reports that `reject_file` and `abort` put in `<path>`):
    - With a Parquet accepted sink, `sink.accepted.path` must differ from `<path>` and from `<path>/rows`: accepted parts
      there would overwrite the raw file copies or the rejected rows.
    - Columns are the entity's declared output columns holding the RAW source values: strings for csv, tsv,
      fixed, json and xml text inputs, native types for parquet, orc and avro inputs. Values are never cast to the
      Silver target type.
    - Then four metadata columns: `__floe_row_index` (UInt64, row index in the whole file), `__floe_errors`
      (String, JSON array as in the CSV), `__floe_run_id` (String) and `__floe_source_uri` (String).
    - PII masking applies before the write.
    - Declared column names starting with `__floe_` are rejected by `floe validate` when `sink.rejected` is set.
    - Parsing normalises nulls and quoting, so byte-faithful replay needs the archived source file
      (`output.archived_path` in `run.json`), not the rejected Parquet.
  - Iceberg output contract (`format: iceberg`, opt-in quarantine table):
    - Binds a catalog like the accepted sink: `iceberg: {catalog, namespace, table, location}` under `sink.rejected`.
      The catalog falls back to `catalogs.default`; without one `floe validate` fails with
      `sink.rejected.iceberg.catalog is required (or set catalogs.default)`. The table defaults to
      `<entity>_rejected`; naming the accepted table fails with `sink.rejected.iceberg must not write to the accepted table`.
      `path` and `storage` locate the table as for the accepted sink.
    - Columns: the declared output columns, ALL `string` (a failed `decimal` cast lands as the text `abc`), then
      `__floe_row_index` (`long`), `__floe_errors`, `__floe_run_id` and `__floe_source_uri` (`string`). Typed inputs
      are cast to string.
    - Append only, whatever `sink.write_mode` is: one commit per entity run for all its files, never per file or row.
      With `schema.schema_evolution.mode: add_columns` new declared columns are added to the table.
    - The rejected commit happens just BEFORE the accepted commit. The two commits are NOT atomic together: if the
      accepted commit fails, the rejected rows stay in their table. The table is at-least-once and append-only: a retry
      appends its rows again, so consumers dedupe on `(__floe_source_uri, __floe_row_index)`, keeping the latest `__floe_run_id`.
    - PII masking applies before the write, so the quarantine table holds masked values. Its access and retention are
      the deployment's responsibility.
    - Whole-file rejects (schema mismatch, `abort`) still copy the raw file to `<path>/<file>`. The table itself
      defaults to `<path>/table`, so those copies never sit in the table location (orphan-file cleanup or an overwrite
      could delete them). `iceberg.location` equal to `path` fails `floe validate` with
      `sink.rejected.iceberg.location must differ from sink.rejected.path (raw file copies are written to the path)`.
    - `output.rejected_path` is the resolved `path`.
    - The retry guard keys on `floe.input_hash`, the same fingerprint of the run's completed files as the accepted snapshot.
- `archive` (optional)
- `path`: directory where raw input files are archived after ingestion.
  - If omitted, archiving is disabled.
  - Supports `{{var}}` templating (see "Templating & domains").
  - Prefer an archive location outside the source path (for example `s3://raw/archive/` next to
    `s3://raw/crm/`). Nesting it under the source is safe: a normal run never lists the
    archive as input, and `--full-refresh` reads it once, explicitly (D31).

### `pii` (optional)

Column-level PII masking applied to accepted rows and to the rejected rows of
`policy.severity: reject` before they are written.

```yaml
pii:
  columns:
    - name: email
      strategy: hash
    - name: credit_card
      strategy: mask
      mask_pattern: "{first4}****{last4}"
    - name: ssn
      strategy: redact
      redact_value: "***"
    - name: notes
      strategy: drop
```

- `columns` (required): array of PII column transforms
  - `name` (required): schema column name (must match `schema.columns[].name`)
  - `strategy` (required): `hash`, `drop`, `nullify`, `redact`, or `mask`
  - `mask_pattern` (required for `strategy: mask`): literal output string with optional `{firstN}` / `{lastN}` tokens
  - `redact_value` (optional, `strategy: redact`): replacement string (default `[REDACTED]`)

See [PII masking](https://openlakeforge.dev/floe/guides/pii/) for full strategy reference and masking pattern syntax.

### `policy` (required)

- `severity` (required)
  - `warn`: keep rows, log violations.
  - `reject`: reject rows with violations (first unique kept, duplicates rejected).
  - `abort`: abort the entire file on first violation.
- `rule_severity` (optional): a map from a rule to `warn`, `reject` or `abort`, overriding `severity` for that rule
  on every column. Keys: `not_null`, `cast_error`, `out_of_range`, `not_allowed`, `pattern_mismatch`, `length`,
  `unique`, `schema_mismatch`, `min_rows_per_file`, and `min_rows` (`warn` or `abort` only, see below). A column's own `rule_severity`
  wins over this map, and this map wins over `severity`. In a domain's `defaults.policy` it merges with the entity's
  map key by key. `reject` or `abort` here requires `sink.rejected`, and `abort` is refused with `pii`.
  See [Checks](https://openlakeforge.dev/floe/concepts/checks/#severity-per-check).
- `max_rejection_rate` (optional, `severity: reject` only)
  - A number in `[0, 1]`: the largest fraction of input rows (`rejected_total / rows_total`) the entity may reject. Above it the entity ends `aborted` (exit `2`); at the threshold it stays `rejected`. The accepted rows are committed either way. `null` clears a domain default.
- `min_rows` (optional)
  - An integer `>= 1`: the fewest input rows (`results.rows_total`, rejected rows included) the run's files must
    hold. Checked after the commit: below it the entity ends `aborted` (exit `2`) at `abort`, or
    `success_with_warnings` at `warn`; abort does **not** roll back, the accepted rows stay committed. The level is
    `rule_severity.min_rows`, else `severity`, where `reject` counts as `abort`. A run whose files are all `skipped`
    (an `incremental_mode: file` run with no new files) is not checked. `min_rows` never requires `sink.rejected`
    and is allowed with `pii`. `0` fails with `config_invalid_value`.
- `min_rows_per_file` (optional)
  - An integer `>= 1`: the fewest rows each input file must have (`1` means no empty file). A file with fewer rows
    is settled whole by `rule_severity.min_rows_per_file` (else `severity`): `reject` copies the raw file to
    `sink.rejected` and accepts none of its rows; `abort` aborts the file and the entity, as any abort does; `warn`
    keeps the rows and counts one warning. The file reports one `validation.rules[]` entry `min_rows_per_file` with
    empty `columns`. `0` fails with `config_invalid_value`. A file the reader cannot read (such as a zero-byte CSV
    with no header) stays an unreadable file on `severity`.

### `schema` (required)

- `normalize_columns` (optional)
  - `enabled`: boolean toggle.
  - `strategy`: `snake_case`, `lower`, `camel_case`, `none`.
  - When enabled, both schema column names and input column names are normalized
    before checks. Two schema columns (or selectors) that normalise to the same name fail `floe validate`; an input column
    that collides with another after normalization fails the run.
- `schema_evolution` (optional, v0.2)
  - Omitted by default, Floe behaves as `mode: strict` and `on_incompatible: fail`.
  - `mode`: `strict` or `add_columns`.
  - `on_incompatible`: `fail`.
  - `mode: add_columns` requires `sink.accepted.format: iceberg` (D13).
  - Current implementation is additive-only:
    - new columns are added to the existing Iceberg table as nullable columns
    - existing columns must remain compatible (same type, no non-nullable → nullable change, none missing)
    - merge-key columns cannot be introduced by evolution during `merge_scd1`
    - partition spec changes are rejected
- `primary_key` (optional)
  - Array of schema column names.
  - Primary key columns are always treated as required (`not_null`) at runtime.
  - Config validation rejects `nullable: true` on primary key columns.
  - `primary_key` is also enforced as a composite unique constraint.
  - In `sink.write_mode: merge_scd1` or `merge_scd2`, `primary_key` is the mandatory merge key.
- `unique_keys` (optional)
  - Array of unique constraints, each constraint being an array of schema column names.
  - Supports single-column and multi-column uniqueness:
    - `unique_keys: [["email"], ["id","country_code"]]`
  - Migration: the per-column `unique: true` flag was removed in 1.0 and now fails validation; replace each flagged column `c` with an entry `["c"]` here.
  - Null semantics: a row is ignored for a constraint if any key component is null.
- `columns` (required)
  - Array of column definitions.
  - `name` (required): target column name in the output schema.
  - `source` (optional): source field selector (including nested JSON/XML extraction).
    - When omitted, defaults to the value of `name`.
    - For CSV/Parquet/ORC/XLSX/Avro, use an input column name.
    - For JSON, selectors may include dot notation and `[index]` (example: `user.names[0]`).
    - For XML, selectors support element paths with `.` or `/`, with optional terminal
      attribute selection (example: `order.customer.@id` or `order/customer/@id`).
    - When `source` is set, `normalize_columns` applies to the source selector for matching,
      but the output column name remains the explicit `name`.
    - When `source` is set, validation summaries and row error logs include the source
      value alongside the column name.
  - `type` (required): logical type. Accepted values are case-insensitive and
    normalized by removing `-` and `_`.
  - `nullable` (optional): default `true`.
  - `min`, `max` (optional): inclusive bounds on an int, float, decimal, date or datetime column (rule
    `out_of_range`). A YAML number or string, converted like a CSV value of the column: quote exact decimals
    (`"99999999.99"`), and a datetime bound is normalised to UTC like the column's values. NaN or infinite bounds
    and `min` above `max` are refused.
  - `allowed_values` (optional): a non-empty list of all strings or all integers, on an int or string column (rule
    `not_allowed`). Each value must convert to the column type.
  - `pattern` (optional): a regular expression the whole value of a string column must match (rule
    `pattern_mismatch`); Floe adds the anchors. Rust `regex` syntax, as run by Polars.
  - `min_length`, `max_length` (optional): non-negative bounds on the number of characters of a string column (rule
    `length`), counted in Unicode code points.
  - A key on a column type it does not apply to fails validation with `config_conflict`. See
    [Checks](https://openlakeforge.dev/floe/concepts/checks/#value-checks-out_of_range-not_allowed-pattern_mismatch-length).
  - `rule_severity` (optional): a map from `not_null`, `cast_error`, `out_of_range`, `not_allowed`,
    `pattern_mismatch` or `length` to `warn`, `reject` or `abort`, for this column only. `not_null` needs a required
    column (`nullable: false` or in `schema.primary_key`), `cast_error` a non-`string` column, and each value rule
    the keys that enable it; otherwise validation fails with `config_conflict`.
- `checks` (optional): row predicates across the columns of a row; see
  [Row predicates](https://openlakeforge.dev/floe/concepts/checks/#row-predicates-schemachecks).
  - `name` (required): lower snake_case (`[a-z][a-z0-9_]*`), unique in the entity, and not a built-in rule name
    (`not_null`, `cast_error`, `out_of_range`, `not_allowed`, `pattern_mismatch`, `length`, `unique`,
    `schema_mismatch`, `schema_error`, `csv_read_error`, `unreadable_file`, `min_rows`, `min_rows_per_file`:
    `config_conflict`). It is the `rule` of the row error and of `validation.rules[]`.
  - `left` (required): a column of `schema.columns` (`config_unknown_reference` otherwise).
  - `op` (required): `eq`, `ne`, `lt`, `le`, `gt`, `ge` (binary) or `is_null`, `not_null` (unary). Symbols such as
    `>=` are refused.
  - `right` or `value`: a binary op takes exactly one, a unary op neither (`config_conflict`). `right` is a column
    of the same kind as `left` (numeric, string, boolean, date or datetime; a date is not compared with a
    datetime). `value` is a literal that must cast to `left`'s type; a boolean `left` takes no `value`.
    `lt`, `le`, `gt` and `ge` do not apply to a string or boolean `left`.
  - `when` (optional): one condition with the keys `left`, `op`, `right`, `value` and the same rules; the check
    applies only to the rows where it holds.
  - `severity` (optional): `warn`, `reject` or `abort`; defaults to `policy.severity`. A predicate name is not a
    `policy.rule_severity` key.

## Supported column types

The parser accepts the following type names (case-insensitive, `-` and `_`
ignored):

- `string`: `string`, `str`, `text`
- `boolean`: `boolean`, `bool`
- `integer`: `int8`, `int16`, `int32`, `int64`, `int`, `integer`, `long`
- `unsigned integer`: `uint8`, `uint16`, `uint32`, `uint64`
- `number` (float64): `number`, `float64`, `float`, `double`
- `decimal(p,s)`: exact decimal, `1 <= p <= 38` and `0 <= s <= p` (for example `decimal(19,2)`).
  Cast to a Polars `Decimal` and written unchanged as Parquet `DECIMAL(p,s)` / Iceberg `decimal(p,s)`.
  A bare `decimal` is rejected: Float64 cannot hold exact values, so use `decimal(p,s)` or `float64`.
  In `cast_mode: strict` exponent notation (`1e-3`) and a value with more digits than the scale (non-zero digits dropped) or the
  precision is a `cast_error`; in `coerce` it is rounded half-even to the scale (out of precision stays an error).
  JSON numbers keep their written digits for `decimal(p,s)` columns.
- `float32`: `float32`
- `date`: `date`
- `datetime`: `datetime`, `timestamp`

`time` is not supported in 0.8 (D10): `floe validate` rejects it.

For more details about checks and severity behavior, see [Checks](https://openlakeforge.dev/floe/concepts/checks/).
Execution order and pipeline phases are documented in [How Floe works](https://openlakeforge.dev/floe/concepts/how-it-works/).

## Templating & domains

Floe supports simple placeholder substitution in string fields using `{{var}}`
syntax. Variables are resolved in this order (lowest to highest precedence):

1) `env.file` variables (YAML map)
2) `env.vars` inline variables (override file values)

In entity path fields (`source.path`, `sink.accepted.path`, `sink.rejected.path`,
`sink.archive.path`), `{{entity.name}}` resolves to the entity's own name, so
domain `defaults` can set per-entity paths such as `"sales/{{entity.name}}"`.

If an entity sets `domain: "<name>"`, the following is also available:

- `{{domain.incoming_dir}}` resolved from the matching domain entry.
- `{{domain.name}}` the domain name.

Unresolved placeholders (or unknown domains) are configuration errors.

## Splitting a single file

Each step leaves a config that validates; run `floe validate -c config.yml`
after each. The result matches [`example/project/`](https://github.com/OpenLakeForge/floe/tree/v1.1.0/example/project/); see
[Floe Projects](https://openlakeforge.dev/floe/guides/projects/) for the full walkthrough.

1. Set `version: "0.3"`.
2. Move repeated input settings into a top-level `sources` list, and replace
   each entity's `source` with `{ ref: <source>, resource: <resource> }`.
   Use `{{resource}}` in the source `path` where entities differ.
3. Move the `sources` list into `sources.yml` (top-level `sources: [...]`), drop
   it from the root config, and add `include: { sources: sources.yml }`.
4. Move repeated output and policy settings (`sink`, `policy`, ...) into each
   domain's `defaults`, and delete them from the entities that match.
5. For each domain, create `<dir>/_domain.yml` with its `name`, `defaults`
   and optional `incoming_dir`, and one sibling `*.yml` file per entity
   (`domain` may be omitted there). Remove those domains and entities from the
   root config and add their glob under `include.domains`, for example
   `domains/*/_domain.yml`.

Relative paths in included files still resolve against the root config, so
source and sink paths need no change when they move.

---

<small>Synced from floe @ `v1.1.0` (`313b534`), [docs/reference/config.md](https://github.com/OpenLakeForge/floe/blob/313b53441b3b088290403ed1adb2f3894833b6c5/docs/reference/config.md).</small>
