Neo4j Python driver doesn't return read result. Neo4j Desktop, same query, does

    @staticmethod
    def _getUser(tx, user_id):
        query = (
            'MATCH (u:User) '
            'WHERE u.user_id = $user_id '
            'RETURN u')
        return tx.run(query, user_id=user_id)

Here is my transaction function, the whole code is too many pages to post. Was wondering why this is not returning anything in result (e.g. result.single() == None).

I am sending it using session.read_transaction(self._getUser, user_id)

This is something I can't really debug without being a Neo4j driver author.

Solution is to try a different driver. I'll try py2neo driver.

1 Like

Update your driver if not
Make sure your parameter type fits with the one in your database.
Make sure you are properly using the result function

1 Like

I encountered the same issue in Python, all queries returning empty results, however in my case it was a simple object lifetime issue. The official neo4j driver works fine.

This occurred after updating from version 1.7.6 to 4.x.x

What I did was returning a result within the with:

driver = GraphDatabase.driver(...)
with driver.session() as session:
    return session.run(query)

On exiting the with, it closes the session, and the results are no longer accessible. Interestingly there is a difference in behaviour of the python driver between old (pre 4) and new versions.