Expand description
Staged bulk load (#528): stage a page to object storage, then have the
warehouse pull it with its native bulk-load command (COPY / COPY INTO /
load-from-URI / s3() table function).
Row-by-row / multi-row INSERT is dramatically slower than the native bulk
path on every cloud warehouse — for Redshift and Snowflake the staged
COPY is the documented, production path. This module holds the shared,
I/O-light pieces every capable sink reuses:
StagingSpec— the user-facingstaging:config block.StagingLocation— a parseds3:///gs:///az://location.StagedFile— a written object’s coordinates (uri / rows / bytes).- record → bytes serialization for
jsonl/csv(+ optional compression), and run-scoped object-key planning. Sink::supports_staged_load— a defaulted, object-safe capability flag.
The object-store upload itself lives behind the crate staging Cargo
feature (it pulls object_store), so faucet-core stays lightweight for
connector authors who don’t need it. Each warehouse sink turns the
StagedFiles into its own load SQL — those generators are pure functions in
the individual sink crates and unit-tested there.
Structs§
- Stage
Uploader - Uploads staged objects to an
ObjectStoreand cleans them up. The store is injected so tests drive it againstobject_store::memory::InMemory. - Staged
File - Coordinates of one object written to the stage.
- Staging
Location - A parsed staging location: a scheme, a bucket/container, and a key prefix.
- Staging
Spec - The user-facing
staging:config block, flattened onto a capable sink’s config. Opt-in: absent means the sink uses its ordinaryINSERTpath.
Enums§
- Staging
Cleanup - When staged objects are deleted after a load.
- Staging
Compression - Outer compression for text staging formats.
- Staging
Format - Physical file format written to the stage.
- Staging
Scheme - The object-store scheme of a
StagingLocation.
Functions§
- build_
object_ store - Build the object store for a location from environment/ambient credentials (the warehouse itself reads the files with its own grant; this store is only how faucet writes them). Kept minimal — richer credential wiring is a follow-up; the default credential chains cover the common case.
- serialize_
records - Serialize a page of records to the staging
format’s raw bytes (before compression). Pure — the upload path applies compression and writes.