Repository navigation
feat: paginate scan/query; batched items()/values() through wrappers (#4) - #8
Merged
Merged
Conversation
…primary_key hook (#4) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Fixes #4 (the parts that need no breaking change; see the two follow-ups below).
__iter__,__len__,scan_items/scan_valuesand the query readers now followLastEvaluatedKeyinstead of reading only the first ~1 MB page._primary_key(k)is the one place a store key becomes the item's primary key (base, partition and prefix readers override it);__getitem__is shared..items()/.values(): dol'sItemsView/ValuesViewseam (copied onto wrappers byStore): keys come lazily from the caller's store in batches of 100, are resolved withdol.inner_most_key, read with oneBatchGetItem, andstore[key]is answered from them only during that lookup, in the calling thread only (same design as perf: SQLAlchemyPersister items()/values() use one query (#11) sqldol#12), so codecs,filt_iterscopes and prefix/partition scoping still apply. Keys the batch did not return (UnprocessedKeys...) fall back toGetItem; aValidationExceptionfalls back; other backend errors propagate. Snapshot per batch.batch_get_item).Adversarial review (Opus; also checked the request against botocore's service model with a Stubber): request shape, reserved-word keys, UnprocessedKeys fallback, unordered responses, Decimal keys, empty-page pagination, error classes of the partition module, dataclass attrs all fine. Confirmed and fixed:
_chunkslisted the whole store first (a full COUNT scan plus all keys before the first pair) -> now lazy; the batch was instance state shared across threads (could be left behind) -> thread-local. Known/minor: a batch DynamoDB rejects outright (e.g. a data field that is also a key field) silently degrades to single GETs.Follow-ups filed: #6 (relax scan_items refusal), #7 (DynamoDbStore decision, recommendation: no).
🤖 Generated with Claude Code