Expand description
Schema-drift detection + policy types (issue #194).
Drift is the divergence between an incoming page’s inferred top-level shape
(via crate::schema::infer_schema) and the sink’s live destination schema
(via crate::Sink::current_schema). The pure diff_schema classifies
each top-level column into one bucket; SchemaDriftPolicy decides what the
pipeline does with the result. Nested objects are treated as a single column.
Structs§
- Column
Change - One column’s drift, expressed in JSON-Schema type-fragment terms
(e.g.
{"type":"integer"}or{"type":["string","null"]}). - Schema
Diff - Result of diffing a page’s inferred shape against the destination schema.
- Schema
Drift Policy - Compiled, ready-to-run drift policy. Cheap to clone.
- Schema
Drift Spec - User-facing
schema:config block (pipeline level). - Schema
Evolution - The applyable subset of a
SchemaDiffhanded tocrate::Sink::evolve_schema. Never carriesincompatiblecolumns — those are routed by the policy.
Enums§
- OnDrift
- What to do when drift is detected.
- OnIncompatible
evolve-only: what to do with a narrowing/incompatible change that can’t be auto-applied.- SqlBase
Type - Backend-neutral base column type inferred from a JSON-Schema fragment. Each SQL sink maps these to its concrete keyword.
Functions§
- adds_
null - True when
topermits null butfromdoes not — the column needs itsNOT NULLconstraint relaxed. - base_
widened - True when the non-null base type family changes from
fromtoto(after the integer→number collapse) — i.e. the column needs anALTER TYPE. - diff_
schema - Diff a page’s inferred shape against the destination schema (top-level columns).
- json_
schema_ base_ type - Map a top-level JSON-Schema type fragment to a base SQL type, or
Nonefor a pure-null fragment (caller falls back to TEXT/NVARCHAR for an added column whose only observed value was null).