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
• to map a local dev directory, set: ln.setup.settings.dev_dir = '.'
Show code cell content
def cleanup(artifact: ln.Artifact):
features_sets = artifact.feature_sets.all()
experiments = artifact.experiments.all()
artifact.delete(permanent=True, storage=False)
features_sets.delete()
experiments.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/j2uxgwFa6Dzgiast0000.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: Ot8a1qZ5ZLD3zUn30000 run: │ kind: dataset otype: DataFrame │ hash: YDf8IRE_ZkxP6cMBO60H8A size: 1.6 KB │ branch: main space: all │ created_at: 2025-11-27 13:44:34 UTC created_by: testuser1 │ n_observations: 3 ├── storage/path: │ /home/runner/work/lamindb/lamindb/docs/storage/test-transfer-to-cloud/.lamindb/Ot8a1qZ5ZLD3zUn30000.parquet ├── Dataset features │ └── var (2 bionty.CellMarker) │ PD1 num │ CD21 num └── Labels └── .organisms bionty.Organism human .experiments wetlab.Experiment experiment-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='uNTxQjkx68SoSUeN', name=None, description=None, n=2, is_type=False, itype='bionty.CellMarker', otype=None, dtype='num', hash='ygZEOY-P2mQUntYonTjRVg', minimal_set=True, ordered_set=False, maximal_set=False, slot=None, branch_id=1, space_id=1, created_by_id=2, run_id=None, type_id=None, validated_by_id=None, composite_id=None, created_at=2025-05-03 21:37:21 UTC, is_locked=False)
→ mapped: Organism(uid='1dpCL6Td')
→ transferred: Artifact(uid='Ot8a1qZ5ZLD3zUn30000'), Experiment(uid='b7NSd36F')
Artifact(uid='Ot8a1qZ5ZLD3zUn30000', version=None, is_latest=True, key=None, description='test-transfer-to-cloud', suffix='.parquet', kind='dataset', otype='DataFrame', size=1610, hash='YDf8IRE_ZkxP6cMBO60H8A', n_files=None, n_observations=3, params=None, branch_id=1, space_id=1, storage_id=3, run_id=178, schema_id=None, created_by_id=2, created_at=2025-11-27 13:44:34 UTC, is_locked=False)
artifact.describe()
Artifact: (0000) | description: test-transfer-to-cloud ├── uid: Ot8a1qZ5ZLD3zUn30000 run: zbjUjuq (__lamindb_transfer__/5rYQ1DZky2qU) │ kind: dataset otype: DataFrame │ hash: YDf8IRE_ZkxP6cMBO60H8A size: 1.6 KB │ branch: main space: all │ created_at: 2025-11-27 13:44:34 UTC created_by: testuser1 │ n_observations: 3 ├── storage/path: │ /home/runner/work/lamindb/lamindb/docs/storage/test-transfer-to-cloud/.lamindb/Ot8a1qZ5ZLD3zUn30000.parquet ├── Dataset features │ └── var (2 bionty.CellMarker) │ CD21 num │ PD1 num └── Labels └── .organisms bionty.Organism human .experiments wetlab.Experiment experiment-test-transfer-to-cloud
assert artifact._state.db == "default"
assert artifact.organisms.get().name == "human"
assert artifact.experiments.get().name == "experiment-test-transfer-to-cloud"
assert artifact.features["var"].count() == 2
/tmp/ipykernel_2908/1699649831.py:4: DeprecationWarning: Use slots[slot].members instead of __getitem__, __getitem__ will be removed in the future.
assert artifact.features["var"].count() == 2
Show code cell content
!rm -r ./test-transfer-to-cloud
!lamin delete --force test-transfer-to-cloud
• deleting instance testuser1/test-transfer-to-cloud