lamindb.core.IsVersioned

class lamindb.core.IsVersioned

Bases: Model

Base class for versioned models.

Attributes

stem_uid

Universal id characterizing the version family. str.

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
versions

Lists all records of the same version family. QuerySet.

>>> new_artifact = ln.Artifact(df2, is_new_version_of=artifact)
>>> new_artifact.save()
>>> new_artifact.versions()

Fields

version CharField

Version (default None).

Defines version of a family of records characterized by the same stem_uid.

Consider using semantic versioning with Python versioning.

Methods

add_to_version_family(is_new_version_of, version=None)

Add current record to a version family.

Parameters:
  • is_new_version_of (IsVersioned) – a record that belongs to the version family.

  • version (str | None, default: None) – semantic version of the record.