pub struct PostgresSourceConfig {
pub connection_url: String,
pub query: String,
pub params: Vec<Value>,
pub max_connections: u32,
pub batch_size: usize,
}Expand description
Configuration for the PostgreSQL query source.
Fields§
§connection_url: StringPostgreSQL connection URL (e.g. postgres://user:pass@host/db).
query: StringSQL query to execute.
params: Vec<Value>Bind parameters for the query. Defaults to empty.
max_connections: u32Maximum number of connections in the pool. Defaults to 10.
batch_size: usizeRecords per emitted StreamPage. Rows are
drained from the sqlx cursor and yielded whenever the buffer reaches
this size. Defaults to DEFAULT_BATCH_SIZE.
batch_size = 0 is the “no batching” sentinel: the cursor 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.
Implementations§
Source§impl PostgresSourceConfig
impl PostgresSourceConfig
Sourcepub fn new(connection_url: impl Into<String>, query: impl Into<String>) -> Self
pub fn new(connection_url: impl Into<String>, query: impl Into<String>) -> Self
Create a new config with the required connection URL and query.
Sourcepub fn with_max_connections(self, max_connections: u32) -> Self
pub fn with_max_connections(self, max_connections: u32) -> Self
Set the maximum number of connections in the pool.
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 result set is emitted in
a single StreamPage.
Trait Implementations§
Source§impl Clone for PostgresSourceConfig
impl Clone for PostgresSourceConfig
Source§fn clone(&self) -> PostgresSourceConfig
fn clone(&self) -> PostgresSourceConfig
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 PostgresSourceConfig
impl Debug for PostgresSourceConfig
Source§impl<'de> Deserialize<'de> for PostgresSourceConfig
impl<'de> Deserialize<'de> for PostgresSourceConfig
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 PostgresSourceConfig
impl JsonSchema for PostgresSourceConfig
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 PostgresSourceConfig
impl RefUnwindSafe for PostgresSourceConfig
impl Send for PostgresSourceConfig
impl Sync for PostgresSourceConfig
impl Unpin for PostgresSourceConfig
impl UnsafeUnpin for PostgresSourceConfig
impl UnwindSafe for PostgresSourceConfig
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