Skip to content

Commit 283cd5d

Browse files
authored
Fix issue where error raised when batch size matches number of entries (#2321)
1 parent 9776163 commit 283cd5d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

optimade/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,9 @@ def insert_from_jsonl(jsonl_path: Path, create_default_index: bool = False) -> N
110110

111111
# Insert any remaining data
112112
for entry_type in batch:
113-
ENTRY_COLLECTIONS[entry_type].insert(batch[entry_type])
114-
batch[entry_type] = []
113+
if batch[entry_type]:
114+
ENTRY_COLLECTIONS[entry_type].insert(batch[entry_type])
115+
batch[entry_type] = []
115116

116117
if bad_rows:
117118
LOGGER.warning("Could not read %d rows from the JSONL file", bad_rows)

0 commit comments

Comments
 (0)