lamindb.save

lamindb.save(records, ignore_conflicts=False)

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:
  • records (Iterable[Record]) – Multiple Record 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.

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(name="My pipeline")
>>> transform.save()

Update a single existing record:

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