Function
commit_batch
(batch_name: str, olbooks: list[dict[str, Any]], batch_size: int = 1000)
Source from the content-addressed store, hash-verified
| 360 | |
| 361 | |
| 362 | def commit_batch(batch_name: str, olbooks: list[dict[str, Any]], batch_size: int = 1000) -> None: |
| 363 | batch = Batch.find(batch_name) or Batch.new(batch_name) |
| 364 | items = [{"ia_id": b["source_records"][0], "data": b} for b in olbooks] |
| 365 | for i in range(0, len(items), batch_size): |
| 366 | batch.add_items(items[i : i + batch_size]) |
| 367 | |
| 368 | |
| 369 | def main( |
Tested by
no test coverage detected