Incremental ingestion
Floe’s file incremental mode tracks source files that already passed through an entity. Later runs skip those files, process only new files, and keep enough state to avoid duplicate work when multiple runners overlap.
Use this when a source directory or object-storage prefix receives new files over time, for example daily partner drops, API exports, or landing-zone batches.
Enable File Incremental Mode
Section titled “Enable File Incremental Mode”Set incremental_mode: file on the entity:
storages: default: raw_s3 definitions: - name: raw_s3 type: s3 bucket: raw-bucket region: eu-west-1 - name: lake_s3 type: s3 bucket: lake-bucket region: eu-west-1
entities: - name: orders incremental_mode: file source: format: csv storage: raw_s3 path: incoming/orders/ sink: write_mode: append accepted: format: parquet storage: lake_s3 path: bronze/orders/ rejected: format: csv storage: lake_s3 path: rejected/orders/ policy: severity: reject schema: columns: - name: order_id type: string nullable: falseIf state.path is omitted, Floe derives the state object under the source root:
<source root>/.floe/state/<entity>/state.jsonFor the example above, the default state URI is:
s3://raw-bucket/incoming/orders/.floe/state/orders/state.jsonOverride The State Path
Section titled “Override The State Path”Use state.path when you want state stored separately from the input prefix:
entities: - name: orders incremental_mode: file state: path: s3://raw-bucket/floe-state/orders/state.json source: format: csv storage: raw_s3 path: incoming/orders/Only explicit s3:// URIs create remote
state. Relative state.path values are local filesystem paths, even when the
source is remote.
Explicit remote state.path values are resolved through the entity’s
source.storage. The URI must therefore match the same storage definition, such
as the same S3 bucket. A separate state
prefix in the same bucket is supported; a separate state bucket is not currently
supported by this override.
Inspect State
Section titled “Inspect State”Use floe state inspect to see the resolved state URI and current JSON:
floe state inspect -c config.yml --entity ordersThis is useful before or after a run to confirm:
- where Floe stores incremental state
- how many files have already been processed
- whether another run currently has active claims
Reset State
Section titled “Reset State”Use floe state reset to empty the state object:
floe state reset -c config.yml --entity orders --yesThe next run treats matching source files as new again. An empty state is the
same as no state, so Floe leaves an empty state.json on storage; resetting an
empty state does nothing. Resets write the empty state conditionally (version
or ETag), so Floe fails if another process changes state while the reset is
running.
State File Shape
Section titled “State File Shape”File incremental state uses schema floe.state.file-ingest.v2:
{ "schema": "floe.state.file-ingest.v2", "entity": "orders", "updated_at": "2026-06-23T09:00:00Z", "files": { "s3://raw-bucket/incoming/orders/orders_001.csv": { "processed_at": "2026-06-23T09:00:00Z", "size": 18422, "mtime": "2026-06-23T08:45:00Z" } }, "claims": { "s3://raw-bucket/incoming/orders/orders_002.csv": { "run_id": "2026-06-23T09-10-00Z", "acquired_at": "2026-06-23T09:10:00Z", "expires_at": "2026-06-23T10:10:00Z", "size": 20114, "mtime": "2026-06-23T09:05:00Z" } }}The files map is durable history: source URIs that finished successfully. The
claims map is temporary ownership: source URIs currently reserved by a run.
With source.partitioning (see config.md), the state also holds
watermark, the latest partition date ingested, and pruned_before: files keeps
no entry dated before it, and a normal run never lists a date before it. Both are
absent without partitioning, and a state file without them is read as having none.
Existing floe.state.file-ingest.v1 files are still readable. Floe upgrades
them to v2 the next time it writes state.
Run Behavior
Section titled “Run Behavior”At the start of an entity run, Floe:
- Loads the state file or creates an empty state.
- Removes expired claims.
- Skips files already present in
files. - Skips files with active claims from another run and emits an incremental warning.
- Claims remaining pending files before accepted sink output is written.
When the entity finishes successfully, Floe promotes this run’s claims into the
files map with observed size and mtime. If the entity fails, Floe releases
this run’s claims so the same files can be retried later. If a file aborts the
entity, the files before it are still written. With append and the merge
modes, Floe promotes those and releases only the aborted file and the files
after it: once the aborted file is fixed, a rerun writes it without writing the
earlier files again. With overwrite, Floe releases every claim of the run.
Note that overwrite always replaces the output with the files this run lists. In file
mode a run lists only the new files, so the output holds just the latest batch: that suits a
“latest snapshot” load, where each file is a full extract. To accumulate every file, use
append or a merge mode. Either way the claims are settled
before the next entity starts, which runs as usual (D36).
If a file URI is already in files but its size or mtime changed, Floe reports it as
skipped with skip_reason: already_ingested_changed and a warning, and still skips it. The URI is the identity;
Floe does not automatically reprocess changed files. To ingest the new version, see
Re-ingest A Changed File.
Re-ingest A Changed File
Section titled “Re-ingest A Changed File”floe state forget -c config.yml --entity orders --file s3://raw/incoming/orders/orders_001.csv --yes--file is repeatable and must be the exact URI floe state inspect prints. The named files
leave files, so the next run ingests them as new; the rest of the state is untouched. Floe
prints each forgotten file’s recorded size, mtime and processed_at. It refuses, and writes
nothing, when a URI is not tracked, is under a live claim, or (with source.partitioning) is
before the listing window, where --full-refresh is the tool.
Floe does not delete the rows the old version wrote:
append: the old rows stay, so the file is duplicated, or its rows are rejected by the unique key, unless you removed them first.merge_scd1/merge_scd2: the re-sent rows become current, even over values that newer files wrote since. To replay in order, forget the corrected file and the newer ones in one command.overwrite: the output is the batch the run lists.
Retries Of An Append
Section titled “Retries Of An Append”An Iceberg append stamps each snapshot with floe.input_hash, a fingerprint of the
entity and its input files (URI, size, mtime). Before reading any file, a run checks it:
filemode: when the run takes over a dead run’s expired claims, it looks for the fingerprint of its pending files in the table’s snapshots since that claim. On a match, the files are reportedskippedwithskip_reason: already_committedand promoted. A file replaced since that claim (same URI, new size or mtime) is read again: its old rows stay in the table, so without a unique key they are kept next to the new ones.- Other modes (
archive,none,row): the same check against the whole input set, over the whole retained history, so a rerun of exactly the same files is skipped too. Only exactly the same set matches: if new files arrived since the run that died, its rows are appended again. Retry before new files land, or usefilemode.
Snapshot expiry must keep at least 7 days and 10 snapshots. If the snapshots since a dead
run’s claim were expired, Floe can’t tell whether that run committed: the run fails and
asks for floe state reset.
A Parquet append has no snapshots to check. In file mode with a unique key, each input
file’s first accepted part is named from the file and its claim, and is published after the
file’s other parts. A retry that takes over a dead run’s claim skips a file whose first part
is in the output, with the same size and mtime, as skipped with
skip_reason: already_committed, and reads the others. Nothing is deleted or overwritten,
and every part in the output counts as existing keys. One window remains: if the run dies
while publishing a file that wrote more than one part, the retry reads that file again and
rejects the rows already published as duplicates. They appear in the rejected output, never
twice in the accepted output.
CAS And Concurrent Runs
Section titled “CAS And Concurrent Runs”Remote state uses compare-and-swap (CAS) writes so two runners cannot silently overwrite each other’s state:
- S3 uses object ETags through conditional writes.
- Local state uses a content-hash version check with a local file lock (D18).
Every state mutation is written only if the version read by the runner is still current. If another runner wins the race, Floe reloads state, backs off, and retries. After repeated conflicts, the run fails with a clear incremental state conflict error.
Claims expire after one hour. A background heartbeat renews active claims during long-running processes so normal long runs keep ownership. If a process crashes, its claims eventually expire and another run can pick those files up.
Permissions
Section titled “Permissions”Remote incremental state needs permission to:
- read the state object
- create or update it with conditional preconditions
- delete it conditionally for
state reset
The source still needs its normal list/read permissions. The state object itself does not require listing except where the selected cloud provider or IAM policy requires it for object access.
Related References
Section titled “Related References”- Full config reference: config.md
- CLI reference: cli.md
- Pipeline details: how-it-works.md
Synced from floe @ v1.1.0 (313b534), docs/concepts/incremental.md.