pub struct SqliteSinkConfig {
pub database_url: String,
pub table_name: String,
pub column_mapping: SqliteColumnMapping,
pub batch_size: usize,
pub max_connections: u32,
}Expand description
Configuration for the SQLite sink.
Fields§
§database_url: StringSQLite database URL (file path or :memory:).
table_name: StringTarget table name.
column_mapping: SqliteColumnMappingHow to map JSON records to columns.
batch_size: usizeMaximum number of rows per multi-row INSERT. Defaults to
DEFAULT_BATCH_SIZE (1000); the recommended value for SQLite.
When the upstream StreamPage carries more records than batch_size,
the sink slices the page into batch_size-row chunks and issues one
multi-row INSERT per chunk, each wrapped in its own BEGIN/COMMIT
transaction. When batch_size = 0, the entire slice is written as a
single multi-row INSERT inside one transaction — useful when the
source already emits pages sized for SQLite (e.g. a Postgres source
configured with batch_size: 1000).
batch_size = 0 is the “no batching” sentinel: upstream framing is
preserved exactly, no internal re-chunking is performed.
max_connections: u32Maximum number of connections in the pool. Defaults to 1.
SQLite serializes writers at the file level, so a single SQLite file
can only ever have one writer at a time. A multi-connection pool against
one file therefore races for the write lock and risks SQLITE_BUSY
errors under concurrency; one writer is the safe default. Raise this only
if your workload is read-heavy against a WAL database (the sink opens the
pool in WAL mode with a busy_timeout, so extra connections can still
read concurrently with the single writer).
Implementations§
Source§impl SqliteSinkConfig
impl SqliteSinkConfig
Sourcepub fn new(
database_url: impl Into<String>,
table_name: impl Into<String>,
) -> Self
pub fn new( database_url: impl Into<String>, table_name: impl Into<String>, ) -> Self
Create a new config with required fields and sensible defaults.
Sourcepub fn column_mapping(self, mapping: SqliteColumnMapping) -> Self
pub fn column_mapping(self, mapping: SqliteColumnMapping) -> Self
Set the column mapping strategy.
Sourcepub fn with_batch_size(self, batch_size: usize) -> Self
pub fn with_batch_size(self, batch_size: usize) -> Self
Set the maximum number of rows per multi-row INSERT.
Pass 0 to opt out of re-chunking — the entire records slice handed
to write_batch is written in a single multi-row INSERT inside one
transaction, preserving upstream StreamPage framing.
Sourcepub fn max_connections(self, n: u32) -> Self
pub fn max_connections(self, n: u32) -> Self
Set the maximum number of connections in the pool.
Trait Implementations§
Source§impl Clone for SqliteSinkConfig
impl Clone for SqliteSinkConfig
Source§fn clone(&self) -> SqliteSinkConfig
fn clone(&self) -> SqliteSinkConfig
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 SqliteSinkConfig
impl Debug for SqliteSinkConfig
Source§impl<'de> Deserialize<'de> for SqliteSinkConfig
impl<'de> Deserialize<'de> for SqliteSinkConfig
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 SqliteSinkConfig
impl JsonSchema for SqliteSinkConfig
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 moreAuto Trait Implementations§
impl Freeze for SqliteSinkConfig
impl RefUnwindSafe for SqliteSinkConfig
impl Send for SqliteSinkConfig
impl Sync for SqliteSinkConfig
impl Unpin for SqliteSinkConfig
impl UnsafeUnpin for SqliteSinkConfig
impl UnwindSafe for SqliteSinkConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more