lamindb_setup.evolve
¶
Manage schema evolutions for datasets.
Import plan declarations before connecting to an instance:
from lamindb_setup.evolve import create_plan
Use the lamin evolve CLI to validate, preview, and apply the plan.
Internal subpackages may change without notice.
Plans¶
Define a Plan and declare its reusable outputs with PlanExports.
|
Turn a declaration function into a |
|
Collect metadata declarations for validation, preview, and apply. |
Mutable context passed to |
|
Base class for declaring the reusable outputs of a |
|
A plan declares something that can never do what it says. |
Declarations¶
Declare features and group them into a Schema, RecordType, or Sheet.
|
Declare a feature and its validation settings. |
|
Declare a type that groups related features. |
|
Declare a type that groups related schemas. |
|
Declare validation rules for a dataset or a sheet's records. |
|
Declare a type that classifies records ( |
|
Declare a record type whose records must satisfy |
|
Seed a named record, optionally with a type and feature values. |
Typed models and dtypes¶
Use Python type annotations and feature() to describe schema fields.
Declarative base class for schemas (see the module docstring). |
Schema-level configuration for a |
|
Legacy dtype wrapper exposing an object |
|
|
A simple, non-categorical dtype (annotation only, e.g. |
|
A list dtype (annotation only, e.g. |
Annotate a registry type with the filters for a categorical feature. |
|
Default lookup field for each categorical registry. |
|
|
Filters for |
|
Filters for |
|
lamindb's canonical dtype string + |
|
Resolve a dtype annotation into lamindb's canonical dtype string. |
|
Fold |
|
Declare per-field feature options on a |
Data migrations¶
Use fill_nulls(), map_values(), and other helpers to migrate existing data.
|
A narrowing data migration attached to a plan object. |
|
Per-value outcome counters a migration reports back to the caller. |
Raised when a data migration fails to relocate every value. |
|
|
A migration giving a value to every row that is null for a feature made non-nullable. |
|
A migration giving every row that omits a newly-required member a value. |
|
A migration rewriting scalar values for a narrowed scalar dtype. |
|
A migration relocating scalar values onto existing records. |
|
A migration rendering categorical values back to strings. |
|
A migration deleting every value stored for the feature. |
|
A migration trashing the records of a record type the plan deletes. |
|
A declaration pointing the datasets a deleted schema validated at another. |
|
A declaration asking the apply to check a sheet's rows against its new schema. |
|
A migration re-exporting the sheet snapshots a schema change invalidated. |
|
A declaration vouching that datasets validated with a feature hold no nulls for it. |
|
A migration accepting a change to a schema's |
|
A migration accepting that a schema's |
|
A migration deleting the values a removed schema member still holds. |
|
A migration that retires a schema member and keeps its values. |
|
A migration removing what the flexible match annotated, as |
|
A migration that leaves an invalidated sheet export as it is. |
|
A migration that deletes a feature and keeps its stored values. |
|
A declaration vouching for the datasets a schema the plan deletes validated. |
|
A declaration keeping the records of a record type the plan deletes. |
|
A declaration moving the records of a record type the plan deletes. |
|
A declaration re-parenting the children of a type the plan deletes. |
|
A declaration opting a seeded record into the plan's edits. |
|
A declaration trashing a seeded record the plan no longer declares. |
Sentinel for "this value is null". |
|
Sentinel for "write the feature's |
Custom migrations¶
Write custom migration logic with helpers such as backfill_members().
|
What a |
|
One kind of target a |
|
What a |
|
What a |
|
What a |
|
What a |
|
What a |
|
What a |
|
What a |
|
Context for rewriting stale sheet exports after a schema migration. |
|
What a |
|
What a |
|
Annotate every row that omits one of the schema's newly-required members. |
|
Delete every value stored for the feature, scalar and categorical alike. |
|
Delete the values a schema's removed members hold on the rows it validates. |
|
Remove what the flexible match annotated on the artifacts a schema curated. |
|
Relocate a feature's scalar values onto existing records ( |
|
Relocate a feature's categorical values to strings ( |
|
Rewrite a feature's scalar values for a narrowed scalar dtype. |
Plan result types¶
|
UID subclass for Space registry, enforcing 12-character length. |
|
UID subclass for Feature registry, enforcing 12-character length. |
|
UID subclass for Record registry, enforcing 16-character length. |
|
UID subclass for Schema registry, enforcing 16-character length. |
|
A deferred call. |
|
Represents a dependency on another object that needs to be materialized first. |
|
Dependencies ordered so that required objects are created first. |
|
A declared address change: |
|
A migration declared for |
|
How a relocation wrote the replacement annotations. |
Environment variables¶
Configure tracking before applying plans. Explicit nonblank track_prefix
and track_space settings in the instance’s CI configuration take precedence
over the environment.
Variable |
Value and purpose |
Default |
|---|---|---|
|
String prefix for tracked transform keys. |
|
|
Space name or UID for tracked runs, transforms, and outputs. |
|
|
Any nonempty value enables tracebacks for handled command-line errors. It does not change Python API exceptions. |
Unset |
PLAN_TRANSFORM_STEM_UID is a variable in each plan file, not an environment
variable. Keep it stable when editing the plan.