Skip to content

fix: pass database_ as connection-level parameter in Neo4jDriver.execute_query()#1577

Open
wahajahmed010 wants to merge 1 commit into
getzep:mainfrom
wahajahmed010:fix/1481-neo4j-database-parameter
Open

fix: pass database_ as connection-level parameter in Neo4jDriver.execute_query()#1577
wahajahmed010 wants to merge 1 commit into
getzep:mainfrom
wahajahmed010:fix/1481-neo4j-database-parameter

Conversation

@wahajahmed010

Copy link
Copy Markdown

Description

Fixes a bug where Neo4jDriver.execute_query() was placing the database_ parameter inside the parameters_ dict, causing it to be treated as a Cypher query parameter ($database_) rather than a connection-level database selection. This meant search queries would run on the default database instead of the target database.

Root Cause

In the original code:

params.setdefault(database_, self._database)
result = await self.client.execute_query(cypher_query_, parameters_=params, **kwargs)

The database_ value was passed inside parameters_, which is the dict for Cypher query parameters. The Neo4j Python driver expects database_ as a separate keyword argument to execute_query().

Fix

Extract database_ from kwargs and pass it directly to self.client.execute_query() as the database_ keyword argument, keeping params separate for actual Cypher query parameters.

Changes

  • graphiti_core/driver/neo4j_driver.py: Modified execute_query() to pass database_ as a connection-level parameter instead of inside the Cypher query parameters dict.

Testing

This change is a straightforward parameter passing fix. The existing test suite requires Neo4j connectivity (integration tests), which cannot be run without a running Neo4j instance. The fix follows the same pattern used by transaction() and session() methods which correctly pass database=self._database.

Closes #1481


This PR was created with AI assistance.

…ute_query()

The database_ parameter was being placed inside the parameters_ dict,
which caused it to be treated as a Cypher query parameter ()
rather than a connection-level database selection. This meant search
queries would run on the default database instead of the target database.

Fix: extract database_ from kwargs and pass it directly to
self.client.execute_query() as the database_ keyword argument, keeping
params separate for actual Cypher query parameters.

Closes getzep#1481

Signed-off-by: Wahaj Ahmed <[email protected]>
@zep-cla-assistant

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. For privacy information, see our Privacy Notice. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA behalf on myself, e-mail: [email protected]

or

I have read the CLA Document and I hereby sign the CLA behalf of my company, e-mail: [email protected]

Signature is valid for 6 months.


Wahaj Ahmed seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
This bot will be retriggered when the Contributor License Agreement comment has been provided. Posted by the CLA Assistant Lite bot.

@wahajahmed010

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA behalf on myself, e-mail:[email protected]

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.

[BUG] Database Parameter Not Honored in Neo4jDriver.execute_query()

1 participant