baml.csv.ReaderOptions
Options for CSV readers. All fields are optional; `null` means default.
Signature
class baml.csv.ReaderOptionsOptions for CSV readers. All fields are optional; null means default.
delimiter, quote, escape, and comment must be single ASCII bytes
(never CR or LF) and mutually distinct; violations throw
Error { kind: Options } at construction, as do negative skip_lines,
max_skipped, or limit. Validating up front means a misconfiguration
surfaces from reader / open, not a million records in.
Source:<builtin>/baml/ns_csv/csv.bamlbytes 3679–6324
Fields
delimiter
string | nullField separator. Exactly one ASCII byte. Default "," ("\t" for TSV).
quote
string | nullQuote character. Exactly one ASCII byte. Default "\"".
quoting
bool | nullfalse treats quote bytes as ordinary data. Default true.
escape
string | nullEscape byte for quotes. null (default) means RFC 4180 "" doubling;
setting it switches to escape-character dialects ("\\" for MySQL-style
dumps).
has_header
bool | nullFirst record is the header. Default true.
headers
string[] | nullSupply (has_header = false) or replace (has_header = true; the
file's header row is consumed) column names.
comment
string | nullRecords whose first byte (outside quotes) matches are skipped. Off by
default — # is valid data.
trim
"none" | "headers" | "fields" | "all" | nullStrip leading/trailing ASCII space and tab from header and/or unquoted
field values. Default "none".
skip_lines
int | nullRaw lines dropped before parsing begins (preamble junk, Excel sep=;
lines, a Markdown code fence). Default 0.
skip_blank_records
bool | nullDrop blank records. Default true.
ragged
"strict" | "pad" | "truncate" | nullRagged-record policy. "strict" (default): width mismatch throws
FieldCount. "pad": short records padded with empty cells (long ones
still throw). "truncate": long records cut to the expected width
(short ones still throw).
null_values
string[] | nullUnquoted cell texts (after trim) treated as null cells. Default [].
encoding
"utf8" | "utf8-lossy" | null"utf8" (default) throws Encoding on invalid bytes; "utf8-lossy"
substitutes U+FFFD.
bom
"strip" | "keep" | nullA leading UTF-8 BOM is stripped by default so it never corrupts the first header name.
on_error
"throw" | "skip" | nullPer-record error policy. "throw" (default): next() throws a
Error for a malformed record and the reader resumes at the next
record. "skip": record-scoped errors are counted and skipped.
on_skip
((baml.csv.Error) -> null throws never) | nullObserver invoked with each skipped record's Error when
on_error = "skip". Constant-memory alternative to skipped().
max_skipped
int | nullHow many skipped Error values skipped() retains. Default 1000.
0 disables retention. skipped_count() stays exact regardless.
limit
int | nullStop after this many data records. Default unlimited.
Implementations
baml.Concrete for T
Source:<builtin>/baml/core.bamlbytes 747–779