Expand description
Warehouse load layer — the TargetLoader seam, its per-warehouse adapters,
and the warehouse-neutral load driver.
OSS decides what a column becomes in the warehouse (TargetColumnSpec via
ExportTarget::resolve_table). A TargetLoader adapter runs the
warehouse-specific load ([bigquery] — free LOAD DATA; [snowflake] —
COPY off a GCS external stage). The driver (run_load /
run_load_cdc) owns the invariant orchestration — spec validation, the
count-integrity gate, the dedup-view wiring, and cleanup ordering — so those
invariants are exercised once through a fake adapter, not per warehouse.
Modules§
- cdc
- CDC current-state dedup view.
- plan
- Config-driven load planning — derive a BigQuery load (native schema, table,
partition, source URIs) from a rivet export config, so a client never
hand-types column types. The schema comes from rivet’s own type resolver
via
rivet check --target bigquery --json(the argv/process boundary, ADR-0026); the table/partition/destination come from the parsed config. - reconcile
- End-to-end load integrity — reconcile source → file → warehouse row counts before (and after) a load.
Structs§
- BigQuery
Loader - Loads Rivet Parquet into a BigQuery dataset via the
bqCLI. - CdcLoad
Report - Outcome of a CDC change-log load: rows appended to the
<table>__changeslog plus the current-state dedup view rebuilt over it. - Load
Report - Outcome of a successful batch load.
- Snowflake
Loader - Loads Rivet Parquet from GCS into Snowflake.
Traits§
- Target
Loader - A warehouse adapter — the small, warehouse-specific seam the
driver drives. Dialect + CLI (
bq/snow), the external stage, BigQuery’s 4,000-partition batch split, andPARSE_JSONall live behind these primitives.
Functions§
- build_
loader - The one place a resolved plan’s
LoadTargetmaps to a concreteTargetLoaderadapter — wiring partition / cluster / connection / run-id from the config. The count gate and cleanup are the driver’s, so the adapter carries noexpected_rows. - open_
store - Open the one [
GcsStore] a load reuses for reconcile, URI listing, and post-gate cleanup — the single production constructorcli::dispatchcalls. - run_
load - Batch load driver. Materialize
tablefromuris, gate the landed rows againstexpected_rows(the reconciled file count;Noneskips the gate), and — only after the gate passes — clean up the source viacleanup(Some((store, gs_prefix))to delete,Noneto keep it). - run_
load_ cdc - run_
load_ incremental - Load an INCREMENTAL export’s delta: APPEND the parquet into
<table>__changes(reusing the CDC changelog append — the delta’s rows land with NULL__op/__pos/__seq, which the view drops) and (re)build a current-state view deduped to the latest row per PK bycursor_column. The manifests’ summedrow_countgates the appended delta, and cleanup runs (only) after the gate — safe because the ledger, not the file prefix, records what’s loaded.