pub struct CopyOptions {
pub source: CopySource,
pub create_table: bool,
pub preserve_pk: bool,
pub if_exists: IfExists,
pub conflict_key: Vec<String>,
pub atomic: bool,
pub batch_size: usize,
pub bulk_mode: BulkMode,
pub copy_format: CopyFormat,
pub verbose: bool,
pub progress: Option<Box<dyn Fn(usize) + Send>>,
}Expand description
Options for a copy operation.
Fields§
§source: CopySource§create_table: boolTranslate source column metadata into destination DDL and
CREATE TABLE if the target does not exist.
preserve_pk: boolWhen combined with create_table, look up
the source table’s declared primary key and include a matching
PRIMARY KEY (...) clause in the emitted DDL. Default false
preserves the v1 column-only contract. Best-effort: source
tables with no declared PK fall through to the column-only DDL.
Ignored in --query mode (no canonical source table to inspect).
if_exists: IfExistsWhat to do if the target table already exists with rows.
conflict_key: Vec<String>User-supplied conflict-key column list, overriding the PK
auto-detection used by IfExists::Skip / IfExists::Upsert.
Empty = fall back to the destination’s declared primary key.
Validated against the source column shape during copy preflight.
Ignored for non-conflict strategies (Error/Append/Truncate).
atomic: boolWrap the entire copy in a single target-side transaction.
batch_size: usizeHow many rows per source-side page / target-side INSERT batch.
bulk_mode: BulkModeWhether to route batches through the destination backend’s
native bulk loader. Default BulkMode::Off preserves
Phase 1 behaviour.
copy_format: CopyFormatWire format for the Postgres COPY bulk path. Other backends
ignore this field. Default CopyFormat::Text.
verbose: boolWhether copy_rows should emit per-event diagnostics on
stderr (currently: a one-line “using native path” notice when
the bulk path is selected, plus the standard fallback warning
in BulkMode::Auto). Mirrors the CLI --verbose flag.
progress: Option<Box<dyn Fn(usize) + Send>>Optional progress callback invoked after each batch with the running row count.