Skip to content

feat: prepared queries with plain Python bind values (minigraf#181) - #14

Merged
adityamukho merged 4 commits into
v3from
feat/181-prepared-ffi
Oct 24, 2026
Merged

adityamukho merged 4 commits into
v3from
feat/181-prepared-ffi

Conversation

@adityamukho

@adityamukho adityamukho commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

PR 3 (python) of project-minigraf/minigraf#181 (spec §4.2, §5, §7.1; plan steps 11–14).

  • src/lib.rs copied from feat: prepared queries and MiniGrafError::Api (minigraf#181) minigraf-binding-template#7: MiniGrafDb.prepare → MiniGrafPreparedQuery, MiniGrafBindValue, MiniGrafError.Api. Core pin bumped to 5f2ba46e (minigraf#738).
  • minigraf/__init__.py: pq.execute(age=30) / pq.execute({"age": 30}) (same for query). bool (checked before int), int (outside i64 → API-017), float, str, None and uuid.UUID (an entity, which also fits value and rule-argument slots) bind as they are. minigraf.Entity, TxCount, Timestamp, ANY_VALID_TIME and minigraf.Value.* cover the rest; any other type raises TypeError. Aliases PreparedQuery and BindValue.
  • Breaking (v3.0.0): API-category errors raise MiniGrafError.Api, no longer MiniGrafError.Other.
  • Consumer contract: one prepared query, executed with two plain values and one typed value. README: a Prepared queries section and the error classes.

Tests (bench machine, Python 3.12): 43 passed, 21 of them new in tests/test_prepared.py. The contract passes. Codex: one test gap (UUID in value/rule slots), fixed.

Merge after minigraf-binding-template#7.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Urda7FD9CYYoxdeGGJa11x

adityamukho and others added 4 commits October 24, 2026 14:23
…pi (minigraf#181)

Shim from minigraf-binding-template#7 and core pin 5f2ba46e
(minigraf#738). db.prepare(text) -> PreparedQuery; execute()/query()
take keyword arguments or a dict. bool, int, float, str, None and
uuid.UUID bind as they are; Entity/TxCount/Timestamp/ANY_VALID_TIME and
minigraf.Value for the rest. API-category errors raise MiniGrafError.Api.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Urda7FD9CYYoxdeGGJa11x
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Urda7FD9CYYoxdeGGJa11x
@adityamukho
adityamukho merged commit 9e8be69 into v3 Oct 24, 2026
13 checks passed
@adityamukho
adityamukho deleted the feat/181-prepared-ffi branch October 24, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant