lamindb.Storage¶
- class lamindb.Storage(root: str, type: str, region: str | None)¶
 Bases:
Registry,TracksRun,TracksUpdatesStorage locations.
A storage location is either a directory/folder (local or in the cloud) or an entire S3/GCP bucket.
A LaminDB instance can manage and link multiple storage locations. But any storage location is managed by at most one LaminDB instance.
Managed vs. linked storage locations
The LaminDB instance can update & delete artifacts in managed storage locations but merely read artifacts in linked storage locations.
When you transfer artifacts from another instance, the default is to only copy metadata into the target instance, but merely link the data.
The
instance_uidfield indicates the managing LaminDB instance of a storage location.When you delete a LaminDB instance, you’ll be warned about data in managed storage locations while data in linked storage locations is ignored.
See also
storageDefault storage.
StorageSettingsStorage settings.
Examples
Configure the default storage location upon initiation of a LaminDB instance:
lamin init --storage ./mydata # or "s3://my-bucket" or "gs://my-bucket"
View the default storage location:
>>> ln.settings.storage PosixPath('/home/runner/work/lamindb/lamindb/docs/guide/mydata')
Dynamically change the default storage:
>>> ln.settings.storage = "./storage_2" # or a cloud bucket
Fields
- created_at DateTimeField
 Time of creation of record.
- created_by ForeignKey
 Creator of record, a
User.
- run ForeignKey
 Last run that created or updated the record, a
Run.
- updated_at DateTimeField
 Time of last update to record.
- id AutoField
 Internal id, valid only in one DB instance.
- uid CharField
 Universal id, valid across DB instances.
- root CharField
 Root path of storage, an s3 path, a local path, etc. (required).
- description CharField
 A description of what the storage location is used for (optional).
- type CharField
 Can be “local” vs. “s3” vs. “gs”.
- region CharField
 Cloud storage region, if applicable.
- instance_uid CharField
 Instance that manages this storage location.
- previous_runs ManyToManyField
 Sequence of runs that created or updated the record.
Methods