Declarations
¶
Declare features, schemas, record types, sheets, and records.
Features¶
- class lamindb_setup.evolve.FeatureType(name, *, type=None, space_uid=None)¶
Declare a type that groups related features.
- Parameters:
name (
str) – Type name within its parent type and space.type (
FeatureType|None, default:None) – Optional parent feature type.space_uid (
SpaceUID|None, default:None) – Target space; otherwise use the plan’s default.
- property uid: Promise[FeatureUID, Self]¶
Get a promise for the UID of the materialized feature type.
- class lamindb_setup.evolve.Feature(name, *, dtype, type=None, synonyms=None, unit=None, description=None, nullable=None, default_value=None, coerce=None, space_uid=None)¶
Declare a feature and its validation settings.
Creating a feature inside a running plan registers it without saving it. Use
LaminDType(float), for example, to declare numeric measurements.- Parameters:
name (
str) – Feature name within its type and space.dtype (
LaminDType[TypeVar(T)] |ResolvedDType) – ALaminDTypeor resolved dtype specification.type (
FeatureType|None, default:None) – Optional feature type.synonyms (
list[str] |None, default:None) – Alternative names.unit (
str|None, default:None) – Unit of measurement.description (
str|None, default:None) – Human-readable description.nullable (
bool|None, default:None) – Whether values may be null.Noneleaves the setting unspecified.default_value (
Any|None, default:None) – Default used during validation.coerce (
bool|None, default:None) – Whether validation may coerce values to the dtype.space_uid (
SpaceUID|None, default:None) – Target space; otherwise use the plan’s default.
- property uid: Promise[FeatureUID, Self]¶
Get a promise for the UID of the materialized feature.
Schemas¶
- class lamindb_setup.evolve.SchemaType(name, *, description=None, type=None, space_uid=None)¶
Declare a type that groups related schemas.
A schema type classifies schemas; it does not define validation rules. Use
typefor a parent type andspace_uidto select its space.
- class lamindb_setup.evolve.Schema(name=None, *, features, index=None, optionals=None, description=None, type=None, otype=None, slots=None, formats=None, itype=None, dtype=None, flexible=None, coerce=None, minimal_set=True, ordered_set=False, maximal_set=False, space_uid=None)¶
Declare validation rules for a dataset or a sheet’s records.
- Parameters:
name (
str|None, default:None) – Schema name within its type and space.features (
list[Feature]) – Member features; pass an empty list for a composite or dynamic schema.index (
Feature|None, default:None) – Feature that identifies rows. It cannot be optional.optionals (
list[Feature] |None, default:None) – Members that may be absent, using objects fromfeatures.description (
str|None, default:None) – Human-readable description.type (
SchemaType|None, default:None) – Optional schema type.otype (
Literal['DataFrame','AnnData','MuData','SpatialData'] |None, default:None) – Dataset object type for a composite schema.slots (
dict[str, lamindb.Schema] |None, default:None) – Child schemas keyed by dataset component, such asobsandvar.formats (
dict[str,dict[str,Any]] |None, default:None) – Storage-format constraints checked during curation.itype (
type[SQLRecord] |DeferredAttribute|None, default:None) – Registry or registry field for dynamic members.dtype (
LaminDType|None, default:None) – Shared dtype for dynamic members.flexible (
bool|None, default:None) – Include additional features of the sameitypein validation and annotation.coerce (
bool|None, default:None) – Whether validation may coerce values to the dtype.minimal_set (
bool, default:True) – Require all non-optional members.ordered_set (
bool, default:False) – Require the declared member order.maximal_set (
bool, default:False) – Reject members outside the schema.space_uid (
SpaceUID|None, default:None) – Target space; otherwise use the plan’s default.
- property itype: Any¶
The schema’s
itype, re-resolved against the connected instance.
- property dtype: Any¶
The schema’s
dtype, re-resolved against the connected instance.
Records and sheets¶
- class lamindb_setup.evolve.RecordType(name, *, description=None, type=None, space_uid=None, single_space_uid=None, exclude_children_from_plans=False)¶
Declare a type that classifies records (
is_type=True).Use
typefor a parent type andspace_uidfor the type’s own space.single_space_uidrestricts its records to one space. To also constrain their feature values, declare aSheet.
- class lamindb_setup.evolve.Sheet(name, *, schema, description=None, type=None, space_uid=None, single_space_uid=None, is_experiment_sheet=False, exclude_children_from_plans=False)¶
Declare a record type whose records must satisfy
schema.The schema must be a
Schema, not a schema type. Its index, if set, must have dtypestrbecause index values are stored inRecord.name. Other settings followRecordType.
- class lamindb_setup.evolve.Record(name=None, *, type=None, features=None, description=None, reference=None, reference_type=None, space_uid=None)¶
Seed a named record, optionally with a type and feature values.
featuresmaps feature declarations or names to values. Existing records are left unchanged when the plan is reapplied, and removing a declaration does not delete the record. Declare an explicit data migration to update or remove it.