fix: use vars(row) instead of dict(row) in _build_collection_from_bulk
dict() on a types.SimpleNamespace raises TypeError: object is not iterable. vars() correctly extracts the __dict__ attribute map. Fixes TestBuildCollectionFailureTracking::test_high_failure_rate_raises_runtime_error.
This commit is contained in:
1 parent
574bb79a0b
commit
5b5bac42fb
1 file changed
+2
-1
@@ -290,7 +290,8 @@ def _build_collection_from_bulk(batch_size: int = DEFAULT_BATCH_SIZE) -> dict:
|
||||
batch_docs: list[str] = []
|
||||
batch_metas: list[dict] = []
|
||||
for row in all_rows:
|
||||
card = dict(row)
|
||||
# Support both sqlite3.Row (supports dict()) and SimpleNamespace (needs vars())
|
||||
card = dict(row) if hasattr(row, "keys") else vars(row)
|
||||
doc = _build_document(card)
|
||||
if not doc.strip():
|
||||
continue
|
||||
|
||||
Reference in new issue
Block a user