pub struct CsvInferenceOptions {
pub delimiter: u8,
pub has_header: bool,
pub quote: Option<u8>,
pub escape: Option<u8>,
pub null_regex: Option<String>,
pub max_sample_records: Option<usize>,
pub column_name_mode: ColumnNameMode,
}Expand description
Options for CSV schema inference.
Controls how CSV files are parsed and how column types are inferred. Use the builder pattern to customize options from the defaults.
§Example
ⓘ
let options = CsvInferenceOptions::new()
.with_delimiter(b'\t')
.with_has_header(false)
.with_column_name_mode(ColumnNameMode::Sanitize);Fields§
§delimiter: u8Field delimiter byte (default: ,).
has_header: boolWhether the first row is a header (default: true).
quote: Option<u8>Quote character (default: Some(b'"')).
escape: Option<u8>Escape character (default: None).
null_regex: Option<String>Regex pattern for values treated as NULL (default: "^$" — empty string).
max_sample_records: Option<usize>Maximum number of records to sample for type inference (default: None — all rows).
column_name_mode: ColumnNameModeHow to format column names in DDL output.
Implementations§
Source§impl CsvInferenceOptions
impl CsvInferenceOptions
Sourcepub fn with_delimiter(self, delimiter: u8) -> Self
pub fn with_delimiter(self, delimiter: u8) -> Self
Set the field delimiter.
Sourcepub fn with_has_header(self, has_header: bool) -> Self
pub fn with_has_header(self, has_header: bool) -> Self
Set whether the CSV has a header row.
Sourcepub fn with_quote(self, quote: Option<u8>) -> Self
pub fn with_quote(self, quote: Option<u8>) -> Self
Set the quote character.
Sourcepub fn with_escape(self, escape: Option<u8>) -> Self
pub fn with_escape(self, escape: Option<u8>) -> Self
Set the escape character.
Sourcepub fn with_null_regex(self, null_regex: Option<String>) -> Self
pub fn with_null_regex(self, null_regex: Option<String>) -> Self
Set the null regex pattern.
Sourcepub fn with_max_sample_records(self, max_sample_records: Option<usize>) -> Self
pub fn with_max_sample_records(self, max_sample_records: Option<usize>) -> Self
Set the maximum number of records to sample.
Sourcepub fn with_column_name_mode(self, mode: ColumnNameMode) -> Self
pub fn with_column_name_mode(self, mode: ColumnNameMode) -> Self
Set the column name mode.
Trait Implementations§
Source§impl Clone for CsvInferenceOptions
impl Clone for CsvInferenceOptions
Source§fn clone(&self) -> CsvInferenceOptions
fn clone(&self) -> CsvInferenceOptions
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CsvInferenceOptions
impl Debug for CsvInferenceOptions
Auto Trait Implementations§
impl Freeze for CsvInferenceOptions
impl RefUnwindSafe for CsvInferenceOptions
impl Send for CsvInferenceOptions
impl Sync for CsvInferenceOptions
impl Unpin for CsvInferenceOptions
impl UnsafeUnpin for CsvInferenceOptions
impl UnwindSafe for CsvInferenceOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more