lamindb.core.IsVersioned¶
- class lamindb.core.IsVersioned¶
Bases:
Model
Base class for versioned models.
Attributes¶
- Meta = <class 'lnschema_core.models.IsVersioned.Meta'>¶
- property pk¶
- property stem_uid: str¶
Universal id characterizing the version family.
The full uid of a record is obtained via concatenating the stem uid and version information:
stem_uid = random_base62(n_char) # a random base62 sequence of length n_char version_uid = encode_base62(md5_hash(version))[:4] # version is, e.g., "1" or "2.1.0" or "2022-03-01" uid = f"{stem_uid}{version_uid}" # concatenate the stem_uid & version_uid
- property versions: QuerySet¶
Lists all records of the same version family.
>>> new_artifact = ln.Artifact(df2, revises=artifact) >>> new_artifact.save() >>> new_artifact.versions()
Methods¶
- delete(using=None, keep_parents=False)¶
- save(*args, force_insert=False, force_update=False, using=None, update_fields=None)¶
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.