Add PreparedQuery for parse-once, execute-many Cypher reads#24
Open
Copilot wants to merge 3 commits into
Open
Conversation
Agent-Logs-Url: https://github.com/sunsided/petgraph-decypher/sessions/5b2491a8-b11f-400b-a439-5ae3871aa30a Co-authored-by: sunsided <495335+sunsided@users.noreply.github.com>
Agent-Logs-Url: https://github.com/sunsided/petgraph-decypher/sessions/5b2491a8-b11f-400b-a439-5ae3871aa30a Co-authored-by: sunsided <495335+sunsided@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add PreparedQuery type for Cypher queries
Add May 10, 2026
PreparedQuery for parse-once, execute-many Cypher reads
There was a problem hiding this comment.
Pull request overview
This PR introduces a new public PreparedQuery API to support parsing/validating read-only Cypher once and executing it repeatedly (optionally parameterized), and refactors the read execution pipeline to accept a borrowed planned query (&CypherQuery) to reduce ownership churn during execution.
Changes:
- Added
PreparedQuerywithparse+ multiple execution entry points (default/strategy, with/without params). - Refactored
ReadQueryExecutor::executeand call sites to execute against&CypherQueryrather than consuming aCypherQuery. - Added integration tests asserting prepared execution matches direct execution results and that mutations are rejected at parse time.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
tests/query_tests.rs |
Adds integration tests covering prepared-query execution equivalence and mutation rejection. |
src/query.rs |
Introduces PreparedQuery and refactors read execution to operate on borrowed planned queries. |
src/lib.rs |
Re-exports PreparedQuery from the crate root as part of the public API. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+62
to
+66
| /// A parsed and validated read-only Cypher query that can be executed multiple times. | ||
| #[derive(Debug, Clone)] | ||
| pub struct PreparedQuery { | ||
| query: CypherQuery, | ||
| } |
Comment on lines
2235
to
2241
| Clause::Return { items, distinct } => { | ||
| return_items = Some(items); | ||
| return_distinct = distinct; | ||
| return_items = Some(items.clone()); | ||
| return_distinct = *distinct; | ||
| } | ||
| Clause::OrderBy { items } => { | ||
| order_by = Some(items); | ||
| order_by = Some(items.clone()); | ||
| } |
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.
This introduces a prepared-query API for read-only Cypher execution so query parsing/validation can happen once and execution can be repeated efficiently, including parameterized runs.
New public API:
PreparedQueryPreparedQuery::parseto parse + validate read-only queries once.executeexecute_paramsexecute_with_strategyexecute_with_strategy_paramsPreparedQueryfrom the crate root.Execution path update
&CypherQuery) instead of requiring ownership.Behavioral coverage
cypher/cypher_paramscalls for equivalent inputs.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
extension.ladybugdb.com/opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node /home/REDACTED/.npm/_npx/5e786f48223a616c/node_modules/gitnexus/scripts/install-duckdb-extension.mjs fts 17179869184 /home/REDACTED/.cache/node-gyp/24.14.1/deps/zlib -I /home/REDACTED/.cache/node-gyp/24.14.1/deps/v8/include -I ../src -I ../../../../node-addon-api --64 23a6�� k/petgraph-decypher/petgraph-decypher/target/debug/deps/thiserror_impl-dbf14981191e3e77.thiserrobash k/petgraph-decypher/petgraph-decypher/target/debug/deps/thiserror_impl-dbf14981191e3e77.thiserro--norc ache/node/24.14.1/x64/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/node--noprofile otlin_binding/sras k/petgraph-decyp-I k/petgraph-decyp/home/REDACTED/.cache/node-gyp/24.14.1/include/node k/petgraph-decyp-I(dns block)If you need me to access, download, or install something from one of these locations, you can either: