pub struct ExportRequest<'a> {
pub query: &'a str,
pub catalog_hint_query: Option<&'a str>,
pub incremental: Option<&'a IncrementalCursorPlan>,
pub cursor: Option<&'a CursorState>,
pub tuning: &'a SourceTuning,
pub column_overrides: &'a ColumnOverrides,
pub page_limit: Option<usize>,
}Expand description
Read-only inputs for a single export call.
Packs the parameters that used to live as 5 positional args on
Source::export into a named struct. sink is not part of this struct
— it is &mut and conceptually the output channel, separate from the
read-only request configuration.
Fields§
§query: &'a strAlready-materialized SQL (after resolve_query). The driver still wraps
it with the dialect-specific incremental predicate via
[crate::source::query::build_incremental_query] when incremental is set.
catalog_hint_query: Option<&'a str>The unwrapped base query to resolve catalog-dependent type hints from
(PostgreSQL NUMERIC precision/scale, which the wire protocol omits — the
driver parses the FROM clause and asks pg_catalog). Chunked, dense and
keyset runners wrap query in a SELECT … FROM (<base>) … subquery that
hides the source table from the catalog parser, so they pass the original
base query here. None ⇒ resolve from query (full/incremental, where it
is already the unwrapped form). Drivers that read precision from the wire
(MySQL) ignore this field.
incremental: Option<&'a IncrementalCursorPlan>§cursor: Option<&'a CursorState>§tuning: &'a SourceTuning§column_overrides: &'a ColumnOverridesPer-column type declarations from rivet.yaml (exports[].columns:).
Drivers apply them during schema building so e.g. a NUMERIC column
without declared precision can still be exported as Decimal128(18,2)
when the user has stated the type explicitly.
page_limit: Option<usize>Keyset (seek) pagination page size (OPT-4). When Some(n) and
incremental carries the key plan, the driver builds one keyset page
(WHERE key > cursor ORDER BY key LIMIT n) instead of the unbounded
incremental/snapshot query. The keyset runner drives the outer loop.
Implementations§
Source§impl<'a> ExportRequest<'a>
impl<'a> ExportRequest<'a>
Sourcepub fn unwrapped(
query: &'a str,
tuning: &'a SourceTuning,
column_overrides: &'a ColumnOverrides,
) -> Self
pub fn unwrapped( query: &'a str, tuning: &'a SourceTuning, column_overrides: &'a ColumnOverrides, ) -> Self
A request whose query is already the unwrapped base form, so
catalog type hints resolve directly from it. Use for snapshot,
incremental and keyset runners: the driver applies any incremental /
keyset predicate internally, so the source table stays visible to the
catalog parser and catalog_hint_query is None.
Sourcepub fn wrapped(
query: &'a str,
base: &'a str,
tuning: &'a SourceTuning,
column_overrides: &'a ColumnOverrides,
) -> Self
pub fn wrapped( query: &'a str, base: &'a str, tuning: &'a SourceTuning, column_overrides: &'a ColumnOverrides, ) -> Self
A request whose query is a SELECT … FROM (<base>) … wrapper that
hides the source table (chunked / dense / time-window). base — the
unwrapped query catalog hints resolve from — is a required argument, so a
wrapping runner cannot silently fall back to the table-hiding wrapper and
lose PG NUMERIC precision (the bug the catalog-hint fix / ADR-0020
closed). Drivers that read precision from the wire (MySQL) ignore it.
Sourcepub fn with_incremental(self, plan: Option<&'a IncrementalCursorPlan>) -> Self
pub fn with_incremental(self, plan: Option<&'a IncrementalCursorPlan>) -> Self
Attach the incremental cursor plan (the driver builds the WHERE cursor > ? ORDER BY predicate). Pass-through Option so mode-polymorphic callers
can forward strategy.incremental_plan() directly.
Sourcepub fn with_cursor(self, cursor: Option<&'a CursorState>) -> Self
pub fn with_cursor(self, cursor: Option<&'a CursorState>) -> Self
Attach the last committed cursor value the next run resumes after.
Sourcepub fn with_page_limit(self, page_limit: usize) -> Self
pub fn with_page_limit(self, page_limit: usize) -> Self
Set the keyset (seek) page size — one bounded … WHERE key > cursor ORDER BY key LIMIT n page instead of the unbounded query.