Skip to main content

Module drift

Module drift 

Source
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§

ColumnChange
One column’s drift, expressed in JSON-Schema type-fragment terms (e.g. {"type":"integer"} or {"type":["string","null"]}).
SchemaDiff
Result of diffing a page’s inferred shape against the destination schema.
SchemaDriftPolicy
Compiled, ready-to-run drift policy. Cheap to clone.
SchemaDriftSpec
User-facing schema: config block (pipeline level).
SchemaEvolution
The applyable subset of a SchemaDiff handed to crate::Sink::evolve_schema. Never carries incompatible columns — 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.
SqlBaseType
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 to permits null but from does not — the column needs its NOT NULL constraint relaxed.
base_widened
True when the non-null base type family changes from from to to (after the integer→number collapse) — i.e. the column needs an ALTER 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 None for a pure-null fragment (caller falls back to TEXT/NVARCHAR for an added column whose only observed value was null).