Transfer artifacts from a local instance to a cloud instance
¶
import lamindb as ln
ln.connect("laminlabs/lamin-dev")
→ connected lamindb: testuser1/test-transfer-to-cloud
→ connected lamindb: laminlabs/lamin-dev
Show code cell content
def cleanup(artifact: ln.Artifact):
features_sets = artifact.schemas.all()
compounds = artifact.compounds.all()
artifact.delete(permanent=True, storage=False)
features_sets.delete()
compounds.delete()
artifacts = ln.Artifact.filter(description="test-transfer-to-cloud")
for artifact in artifacts:
cleanup(artifact)
→ a file/folder remains here: /home/runner/work/lamindb/lamindb/docs/storage/test-transfer-to-cloud/.lamindb/cinWFwFmf5UHv2dI0000.parquet
! moved records to trash (branch_id = -1)
! moved records to trash (branch_id = -1)
artifact = ln.Artifact.connect("testuser1/test-transfer-to-cloud").get(
description="test-transfer-to-cloud"
)
artifact.describe()
Artifact: (0000) | description: test-transfer-to-cloud ├── uid: W6IeHl2htyKN97fm0000 run: │ kind: dataset otype: DataFrame │ hash: tf8xmO4a3_kkB7dxC6ae9g size: 1.6 KB │ branch: main space: all │ created_at: 2026-02-05 16:21:22 UTC created_by: testuser1 │ n_observations: 3 ├── storage/path: │ /home/runner/work/lamindb/lamindb/docs/storage/test-transfer-to-cloud/.lamindb/W6IeHl2htyKN97fm0000.parquet ├── Dataset features │ └── var (2 bionty.CellMarker) │ CD21 num │ PD1 num └── Labels └── .organisms bionty.Organism human .compounds pertdb.Compound compound-test-transfer-to-cloud
artifact.save(transfer="annotations")
! no run & transform got linked, call `ln.track()` & re-run
→ returning schema with same hash: Schema(uid='8e9HihOBLS6HenmP', is_type=False, name=None, description=None, n_members=2, coerce=None, flexible=False, itype='bionty.CellMarker', otype=None, hash='cUhsAI-g_fRwslfyvt3e7w', minimal_set=True, ordered_set=False, maximal_set=False, branch_id=1, space_id=1, created_by_id=2, run_id=None, type_id=None, created_at=2026-01-10 17:38:21 UTC, is_locked=False)
→ mapped: Organism(uid='1dpCL6TduFJ3AP'), Compound(uid='3ZSD0VhOeaIFHC')
→ transferred: Artifact(uid='W6IeHl2htyKN97fm0000')
Artifact(uid='W6IeHl2htyKN97fm0000', version_tag=None, is_latest=True, key=None, description='test-transfer-to-cloud', suffix='.parquet', kind='dataset', otype='DataFrame', size=1610, hash='tf8xmO4a3_kkB7dxC6ae9g', n_files=None, n_observations=3, branch_id=1, space_id=1, storage_id=3, run_id=178, schema_id=None, created_by_id=2, created_at=2026-02-05 16:21:22 UTC, is_locked=False)
artifact.describe()
Artifact: (0000) | description: test-transfer-to-cloud ├── uid: W6IeHl2htyKN97fm0000 run: zbjUjuq (__lamindb_transfer__/5rYQ1DZky2qU) │ kind: dataset otype: DataFrame │ hash: tf8xmO4a3_kkB7dxC6ae9g size: 1.6 KB │ branch: main space: all │ created_at: 2026-02-05 16:21:22 UTC created_by: testuser1 │ n_observations: 3 ├── storage/path: │ /home/runner/work/lamindb/lamindb/docs/storage/test-transfer-to-cloud/.lamindb/W6IeHl2htyKN97fm0000.parquet ├── Dataset features │ └── var (2 bionty.CellMarker) │ CD21 num │ PD1 num └── Labels └── .organisms bionty.Organism human .compounds pertdb.Compound compound-test-transfer-to-cloud
assert artifact._state.db == "default"
assert artifact.organisms.get().name == "human"
assert artifact.compounds.get().name == "compound-test-transfer-to-cloud"
assert artifact.features.slots["var"].members.count() == 2
Show code cell content
!rm -r ./test-transfer-to-cloud
!lamin delete --force test-transfer-to-cloud