SODA: query-by-example (QBE) find (#201)#208
Merged
Merged
Conversation
Third step of the #163 SODA umbrella, extending SodaOperation into a full read builder over DBMS_SODA: - filter(qbe) (a dict or JSON string), skip(n), limit(n) chained on collection.find(). - count() -> number of matches. - getDocuments() -> every matching SodaDocument, materialised through a SODA_CURSOR_T loop into host arrays (cursor.arrayvar, #122) in one round trip. Without limit() it caps at a fixed count and raises on overflow rather than truncating. - getOne() now returns the first match for a key OR a filter. RE / regression note: SODA's op.get_one() returns a stale result when its filter is a bind variable and the same statement runs again (it caches the first call's filter); op.get_cursor() re-evaluates correctly. So getOne runs the cursor path with a limit of 1 — which also matches oracledb's "first matching document" semantics. count() and get_cursor() with bind filters were verified to re-evaluate across calls. Sync + async; 23ai/21c pass, 11g/9i skip. Per-document content keeps the 32767-byte inline read limit from #200. Closes #201 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Peter Lemenkov <lemenkov@gmail.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.
Third step of the #163 SODA umbrella —
SodaOperationbecomes a full read builder overDBMS_SODA.API (sync + async)
find().filter(qbe)(dict or JSON string) ·.skip(n)·.limit(n).count()→ number of matches.getDocuments()→ every matchingSodaDocument, materialised through aSODA_CURSOR_Tloop into host arrays (cursor.arrayvar, PL/SQL associative-array (collection) binds #122) in one round trip. Without.limit()it caps at a fixed count and raises on overflow rather than truncating (streaminggetCursoris a follow-up)..getOne()now returns the first match for a key or a filter.Notable regression caught
SODA's
op.get_one()returns a stale result when its filter is a bind variable and the same statement runs again — it caches the first call's filter.op.get_cursor()re-evaluates correctly. SogetOneruns the cursor path withlimit 1(which also matches oracledb's "first matching document" semantics). Confirmed pyoracle's bind handling is fine (a 13-bind block re-binds correctly); the staleness is purely inside SODA'sget_one().count()/get_cursor()with bind filters were verified to re-evaluate across calls.Tests: offline
_norm_filter; live count/filter/getDocuments/skip/limit, the getOne filter-reevaluation regression, and the overflow guard — sync + async, 23ai/21c pass, 11g/9i skip. Offline suite 527. Per-document content keeps the 32767-byte inline read limit from #200.Closes #201
🤖 Generated with Claude Code