lamindb.save .md

lamindb.save(records, ignore_conflicts=False, batch_size=10000)

Bulk save objects.

Note

This is a much faster than saving objects using object.save().

Warning

Bulk saving neither automatically creates related objects nor updates existing records! Use record.save() for these use cases.

Parameters:
  • records (Iterable[SQLRecord]) – Multiple SQLRecord objects.

  • ignore_conflicts (bool | None, default: False) – If True, 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 SQLRecord objects:

labels = [ln.ULabel(f"Label {i}") for i in range(10)]
ln.save(labels)

For a single object, use object.save():

transform = ln.Transform(key="My pipeline")
transform.save()

Update a single existing object:

transform = ln.Transform.get("0Cb86EZj")
transform.description = "New description"
transform.save()