lamindb.save¶
- lamindb.save(records, ignore_conflicts=False, batch_size=10000)¶
Bulk save records.
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.batch_size (
int, default:10000) – Number of records to process in each batch. Large batch sizes can improve performance but may lead to memory issues.
- Return type:
None
Examples
Save a list of records:
>>> labels = [ln.ULabel(f"Label {i}") for i in range(10)] >>> ln.save(projects)
For a single record, use
record.save():>>> transform = ln.Transform(key="My pipeline") >>> transform.save()
Update a single existing record:
>>> transform = ln.Transform.get("0Cb86EZj") >>> transform.description = "New description" >>> transform.save()