lamindb.models.LazyArtifact

class lamindb.models.LazyArtifact(suffix, overwrite_versions, **kwargs)

Bases: object

Lazy artifact for streaming to auto-generated internal paths.

This is needed when it is desirable to stream to a lamindb auto-generated internal path and register the path as an artifact (see Artifact).

This object creates a real artifact on .save() with the provided arguments.

Parameters:
  • suffix (str) – The suffix for the auto-generated internal path

  • overwrite_versions (bool) – Whether to overwrite versions.

  • **kwargs – Keyword arguments for the artifact to be created.

Examples

Create a lazy artifact, write to the path and save to get a real artifact:

lazy = ln.Artifact.from_lazy(suffix=".zarr", overwrite_versions=True, key="mydata.zarr")
zarr.open(lazy.path, mode="w")["test"] = np.array(["test"]) # stream to the path
artifact = lazy.save()

Attributes

property path: UPath

Methods

save(upload=None, **kwargs)
Return type:

Artifact