lamindb.Storage

class lamindb.Storage(root: str, type: str, region: str | None)

Bases: Record, TracksRun, TracksUpdates

Storage 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_uid field 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

storage

Default storage.

StorageSettings

Storage 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

Attributes

property path: UPath

Bucket or folder path.

Cloud storage bucket:

>>> ln.Storage("s3://my-bucket").save()

Directory/folder in cloud storage:

>>> ln.Storage("s3://my-bucket/my-directory").save()

Local directory/folder:

>>> ln.Storage("./my-directory").save()

Fields

run: Run

Last run that created or updated the record.

id: int

Internal id, valid only in one DB instance.

uid: str

Universal id, valid across DB instances.

root: str

Root path of storage. n s3 path. local path, etc. (required).

description: str

A description of what the storage location is used for (optional).

type: str

Can be “local” vs. “s3” vs. “gs”.

region: str

Cloud storage region, if applicable.

instance_uid: str

Instance that manages this storage location.

previous_runs: Run

Sequence of runs that created or updated the record.

created_at: datetime

Time of creation of record.

created_by: User

Creator of record.

updated_at: datetime

Time of last update to record.

Methods