Skip to content

Csv

Parse CSV from field text.

Transform json

actions:
- csv: {}
JSON
{
"actions": [
{
"csv": {}
}
]
}

A ✓ marks a field that accepts a context variable such as {{ VARIABLE }}.

on-error handles CSV parsing, width and typed conversion failures:

Mode Failed record
keep-partial Keep converted fields and warn (the legacy default).
keep-original Keep the original record and warn.
discard-record Drop the record, count it once as filtered and warn.
fail-job Stop the Job with a failure diagnostic.
quarantine Keep the original record and warn; route its error outcome to a quarantine destination.

outcome-field is an optional author-owned top-level field containing success, partial (keep-partial failures), or error (other failures). Quarantine requires this field and a rule-based channel whose error route selects the quarantine Job. The failed record retains the CSV input even with remove: true.

In LyftData 3.0, CSV expansion (one input producing multiple records, such as expand with mode: csv) is not supported together with rule-based failure routing or quarantine. Do not combine them.

LyftData 3.0 supports a bounded durable CSV contract for file-store workflows. Durable CSV replay is not a 3.0 guarantee.

For a durable file-store workflow, put the CSV action options under transport.durable.csv, alongside source-epoch. Explicit on-error, outcome-field and inline fields opt the generated Reader into one stateless CSV action per accepted JSON object. Headers, document state, conditions, external field files and expanding into multiple records are refused. The input field must be a literal source key; ${...} expansion is refused. The outcome field must be a literal top-level routing key without path separators or ${...} expansion. Reserve it for this action because each parsed row overwrites its value.

transport:
kind: file-store
path: /isolated/objects
durable:
source-epoch: generated-topic-v1
csv:
input-field: __csv
fields: {name: str, protocol: num}
on-error: keep-original
outcome-field: csv_outcome

A single destination needs no explicit channel override. For quarantine, use the workflow’s conditional dispatch with router-field: csv_outcome, a healthy default, success and partial selecting that same healthy port, and error selecting a separate quarantine port. Each route must name exactly one Egress Job, and every Egress must use an unbatched HTTP POST with a one-item acknowledgement contract. The Worker pins the complete routing table for the lifetime of the assignments.

Discard records complete locally before their payload is dropped. Kept and quarantined records complete only after a validated destination receipt. Fail-job leaves the failed and later records pending. Replaying pending CSV work after a restart is not a 3.0 guarantee, so keep source objects until your destinations confirm receipt. A loopback receipt demonstrates this bounded contract; it does not establish exactly-once behavior for an arbitrary remote sink. Workflows without an explicit mode retain the existing Standard/no-actions guards.

Field Type Required Description
description string describe this step.
condition lua-expression (string) Only run this action if the specified condition is met.
Examples: 2 * count()
on-error string Failed-row policy: keep-partial (default), keep-original, discard-record, fail-job, or quarantine. See Record failures.
outcome-field string Optional author-owned top-level field for success, partial, or error; required for quarantine and durable CSV.
delim string Override the default delimiter, which is a comma.
suppress-warnings ✓ boolean (bool) Suppress warnings generated by this action.
Default: false
input-field field (string) Field containing CSV data, default is ‘_raw’.
Examples: data_field
remove ✓ boolean (bool) Remove the field containing the value.
Default: false
relaxed-schema ✓ boolean (bool) Allow picking & naming just the first few fields.
Default: false
header ✓ boolean (bool) Whether to treat first line as a CSV header.
Default: false
gen-headers ✓ boolean (bool) Whether to generate automatic CSV headers.
Default: false
autoconvert ✓ boolean (bool) Force auto-conversion into numbers wherever possible.
Default: true
skip-lines ✓ number (integer) Skip a fixed number of leading lines before parsing.
Examples: 42, 1.2e-10
header-regex ✓ regex (string) Treat the first line matching this pattern as the header row.
Examples: \d+[A-Z]*
persist-header ✓ boolean (bool) Persist the most recent header across subsequent files or documents.
Default: false
fields map (string) Specify fields and their types (str, num, bool, num).
field-file path (string) A file containing the fields as name:type.
Examples: /path/to/file, c:\users\joe\data\file.txt
header-fields Header Fields Detailed control of how headers are defined.
Failure Handling
Field Type Required Description
on-error On Error Handle CSV row failures; omission keeps the legacy partial record with a warning.
Default: keep-partial
Allowed values: keep-partial, keep-original, discard-record, fail-job, quarantine
outcome-field field (string) Optional author-owned literal top-level field for success, partial or error. It is overwritten on each parsed row, independently of warning settings.
Examples: data_field
Field Type Required Description
header-field field (string) Field containing header (CSV column names).
Examples: data_field
header-field-types ✓ boolean (bool) Field containing header has types specified (with name:type format).
Default: false
header-field-on-change ✓ boolean (bool) With ’header-field, only write out headers if columns change.<br>Default: false`
null-value string A subSstitute string value to be used in the event that a field is null.
Field Type
event.field str

Key format: field.

Value Aliases Name Description
keep-partial keep-partial Keep already converted fields and warn; this is the legacy default.
keep-original keep-original Keep the complete original record and warn.
discard-record discard-record Discard this record and warn without stopping subsequent records.
fail-job fail-job Stop this Job with a failure diagnostic.
quarantine quarantine Preserve the original record and warn; route its error outcome to quarantine.