lamindb.save¶
- lamindb.save(records, ignore_conflicts=False, **kwargs)¶
Bulk save to registries & storage.
Note
This is a much faster than saving records using
record.save()
.Warning
Bulk saving neither automatically creates related records nor updates existing records! Use
record.save()
for these use cases.- Parameters:
ignore_conflicts (
bool
|None
, default:False
) – IfTrue
, do not error if some records violate a unique or another constraint. However, it won’t inplace update the id fields of records. If you need records with ids, you need to query them from the database.**kwargs – Get kwargs related to parents.
- Return type:
None
Examples
Save a collection of records in one transaction, which is much faster than writing a loop over
projects.save()
:>>> labels = [ln.ULabel(f"Label {i}") for i in range(10)] >>> ln.save(projects)
For a single record, use
record.save()
:>>> transform = ln.Transform(name="My pipeline") >>> transform.save()
Update a single existing record:
>>> transform = ln.filter(ln.Transform, uid="0Cb86EZj").one() >>> transform.name = "New name" >>> transform.save()