pub struct CsvSourceConfig {
pub path: String,
pub has_headers: bool,
pub delimiter: u8,
pub quote: u8,
pub batch_size: usize,
pub compression: CompressionConfig,
}Expand description
Configuration for the CSV file source.
Fields§
§path: StringPath to the CSV file.
has_headers: boolWhether the file has a header row. Defaults to true.
delimiter: u8Field delimiter byte. Defaults to b','.
quote: u8Quote character byte. Defaults to b'"'.
batch_size: usizeRecords per emitted StreamPage. Rows are
parsed line-by-line from a tokio BufReader and yielded whenever the
buffer reaches this size. Defaults to DEFAULT_BATCH_SIZE.
batch_size = 0 is the “no batching” sentinel: the file is fully
drained and the entire result set is emitted in a single page. Useful
for small lookup tables or for sinks (e.g. SQL COPY, BigQuery load
jobs) that prefer one large request to many small ones.
compression: CompressionConfigcompression only.Compression codec for the input file. Defaults to
CompressionConfig::Auto —
.gz / .zst suffix selects gzip / zstd. Requires the crate-local
compression feature.
Implementations§
Source§impl CsvSourceConfig
impl CsvSourceConfig
Sourcepub fn new(path: impl Into<String>) -> Self
pub fn new(path: impl Into<String>) -> Self
Create a new config with the required file path and sensible defaults.
Sourcepub fn has_headers(self, v: bool) -> Self
pub fn has_headers(self, v: bool) -> Self
Set whether the file has a header row.
Sourcepub fn with_batch_size(self, batch_size: usize) -> Self
pub fn with_batch_size(self, batch_size: usize) -> Self
Set the per-page row count for Source::stream_pages.
Pass 0 to opt out of batching — the entire file is emitted in a
single StreamPage.
Sourcepub fn compression(self, c: CompressionConfig) -> Self
Available on crate feature compression only.
pub fn compression(self, c: CompressionConfig) -> Self
compression only.Set the compression codec. Available only with the compression feature.
Trait Implementations§
Source§impl Clone for CsvSourceConfig
impl Clone for CsvSourceConfig
Source§fn clone(&self) -> CsvSourceConfig
fn clone(&self) -> CsvSourceConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CsvSourceConfig
impl Debug for CsvSourceConfig
Source§impl<'de> Deserialize<'de> for CsvSourceConfig
impl<'de> Deserialize<'de> for CsvSourceConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for CsvSourceConfig
impl JsonSchema for CsvSourceConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more