fix: paginate status() metadata fetch to avoid SQLite variable limit#803
Open
srgvg wants to merge 1 commit intoMemPalace:developfrom
Open
fix: paginate status() metadata fetch to avoid SQLite variable limit#803srgvg wants to merge 1 commit intoMemPalace:developfrom
srgvg wants to merge 1 commit intoMemPalace:developfrom
Conversation
col.get(limit=total) crashes with "too many SQL variables" once the palace exceeds ~30k drawers (SQLite binds one variable per item). Fetch metadatas in batches of 5000 instead. Reproduces on any palace with > ~32766 drawers. Workaround until this fix ships: sqlite3 chroma.sqlite3 "SELECT COUNT(*) FROM embeddings;"
Contributor
|
Can confirm this is a real issue — we hit it with a 134K-drawer palace. Our fork has the same paginated approach in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mempalace statuscrashes withsqlite3.OperationalError: too many SQL variableson palaces with >~30k drawerscol.get(limit=total, include=["metadatas"])passes the full count as limit; SQLite binds one variable per metadata item and hits the compile-time limit (~32766)offsetparameter oncol.get()Fixes #802
Test plan
python -m pytest tests/ -v --ignore=tests/benchmarks— 687 tests pass (2 pre-existing failures intest_version_consistency.pyunrelated to this change)ruff check .— cleanmempalace statuson a palace with 50k+ drawers completes without error