This repository was archived by the owner on Nov 21, 2026. It is now read-only.
Repository navigation
Record ids in rows: pin the contract both wheels share (tests and docs) - #530
Merged
Merged
Conversation
A record id inside a row (SELECT @Rid, a LINK property, a list of links) is an RID object on both wheels: str() is the text, equal RIDs hash alike, RIDs sort by bucket and position, getBucketId/getPosition/toString/isValid work, and an RID goes back in as a query parameter and to lookup_by_rid. get_rid() is text. The JVM wheel already behaves this way (its RID is the engine's own); the test file runs on both wheels and the docs state the contract and the one thing not to rely on (rid == "#10:5" is False on the JVM wheel). Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…to the statement Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
A record id inside a row came back as two different things: the JVM wheel hands out the engine's own
RID(a JPype object whosestr()is#10:5), the native wheel a Python class of its own. A digest of the same query on both wheels showed it. This PR pins what the two have in common, so that code written against one runs on the other. The JVM wheel needs no code change: its behaviour is the contract.The contract, written in
docs/api/results.mdunder "Record ids in rows": a record id in a row value (SELECT @rid, aLINKproperty, a list of links) is an RID object;str(rid)is the text; RIDs of one record are equal and hash alike; RIDs sort by bucket and position;getBucketId(),getPosition(),toString()andisValid()work; it goes back in as a query parameter and tolookup_by_rid()as itself or as its text;get_rid()is text orNone. I chose the object over text because the docs already said so (results.md: RIDs "over as the engine's own object";record-wrappers.md:get_identity()is the RID object, "for a string RID useget_rid()orstr(...)") and because the JVM wheel has more users whose code callsgetBucketId()or passes the value straight back as a parameter. One thing is deliberately not part of the contract:rid == "#10:5"isFalseon the JVM wheel andTrueon the native wheel, so the docs say to comparestr(rid).Also fixed in the docs:
lookup_by_ridis documented as taking an RID string, and it also takes the RID object a row holds (a docstring anddatabase.mdline, no code change).get_rid()now documents which rows have an identity (a record row,expand(), a projection of@ridwithout an alias).The native side is a separate PR into
native-preview(the native RID gets the missing methods and ordering, andResult.get_rid()takes a projected@rid), with the same test file and the same docs.Local checks, all on this branch's last commit:
tests/test_record_id_values.py12 passed on the JVM wheel (new, shared with the native wheel);test_core.py,test_resultset.py,test_graph_api.py,test_docs_examples.py91 passed (103 with the new file); pre-commit hooks (black, isort, whitespace, A/B tables) passed. Not run: the full suite and CI.🤖 Generated with Claude Code