Skip to content

#2114 add test for named parameterized Cypher query handling#2410

Merged
robfrank merged 1 commit into
mainfrom
fix/2114-cypher-params
Aug 11, 2025
Merged

#2114 add test for named parameterized Cypher query handling#2410
robfrank merged 1 commit into
mainfrom
fix/2114-cypher-params

Conversation

@robfrank

Copy link
Copy Markdown
Collaborator

#2114
This pull request adds a new test to ensure that the driver correctly handles named parameterized Cypher queries using the psycopg2 interface. This helps verify that named parameters are properly substituted in Cypher statements.

Testing improvements:

  • Added test_psycopg2_with_named_parameterized_cypher_query to validate support for named parameters in Cypher queries executed via the psycopg2 driver (test_arcadedb.py).

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @robfrank, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

I've added a new test case to ensure our driver correctly handles named parameterized Cypher queries when using the psycopg2 interface. This enhancement verifies that parameters are properly substituted, improving the robustness of our query execution.

Highlights

  • New Test for Cypher Query Parameterization: I've introduced test_psycopg2_with_named_parameterized_cypher_query in e2e-python/tests/test_arcadedb.py. This test specifically validates that the driver correctly processes and substitutes named parameters within Cypher queries executed via the psycopg2 driver.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@robfrank robfrank added the fixed label Aug 11, 2025
@robfrank robfrank added this to the 25.7.1 milestone Aug 11, 2025
@robfrank robfrank self-assigned this Aug 11, 2025
@robfrank robfrank merged commit ec313a1 into main Aug 11, 2025
8 of 10 checks passed
@robfrank robfrank deleted the fix/2114-cypher-params branch August 11, 2025 10:13

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a test for named parameterized Cypher queries. The implementation is mostly correct, but I've found a couple of areas for improvement. The test's docstring should be more specific to Cypher queries for clarity. More importantly, the assertion in the new test is likely incorrect because of how results from a RETURN <node> Cypher query are structured, and I've suggested a fix. Please see my detailed comments.

query_params = {'name': 'Stout'}
cursor.execute('{cypher} MATCH (b:Beer) WHERE b.name =%(name)s RETURN b', query_params)
beer = cursor.fetchall()[0]
assert 'Stout' in beer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The Cypher query RETURN b results in a single-column result set. cursor.fetchall()[0] assigns the first row (a single-element tuple) to beer. The assertion assert 'Stout' in beer incorrectly checks for 'Stout' as an element of this tuple. To fix this, the assertion should check for 'Stout' within the node representation, which is the first element of the beer tuple (beer[0]).

Suggested change
assert 'Stout' in beer
assert 'Stout' in beer[0]

conn.close()

def test_psycopg2_with_named_parameterized_cypher_query():
"""Check if the driver correctly handles parameterized named queries"""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The docstring is a copy from the preceding SQL test. For better clarity and maintainability, please update it to reflect that this test is for a Cypher query.

Suggested change
"""Check if the driver correctly handles parameterized named queries"""
"""Check if the driver correctly handles named parameterized Cypher queries"""

@codacy-production

Copy link
Copy Markdown

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.21%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (3a08ebe) 70761 45456 64.24%
Head commit (83e05da) 70761 (+0) 45603 (+147) 64.45% (+0.21%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#2410) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

robfrank added a commit that referenced this pull request Aug 21, 2025
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