'BoltDriver' object has no attribute 'execute_query'

Hi to all
Why does the following not work:

from collections import defaultdict
from neo4j import GraphDatabase

driver = GraphDatabase.driver (
"bolt://localhost:7687",
auth=("neo4j", ".......")) #pw removed

driver.verify_connectivity()
results in: 'Neo4j/5.9.0', so connection seems to work

records, summary, keys = driver.execute_query(
"MATCH (n) RETURN n",
database_="neo4j",
)
results in: AttributeError: 'BoltDriver' object has no attribute 'execute_query'

I am using Anaconda for package management of Jupyter Lab. Am I missing some package there or any other idea?

Kind regards, Rob

I'll make a guess here. You might have installed a too old version of the driver. You'll need at least version neo4j>=5.5.0 where that API was introduced. Preferably neo4j>=5.8.0 in which the feature was moved out of preview and stabilized.

See also https://github.com/neo4j/neo4j-python-driver/wiki/preview-features#driverexecute_query

1 Like

Hi Rouven
Your guess was absolutely right! Thank you very much.
I figured out that conda-forge was not in my anaconda-channels. By adding it I could install Version 5.10.0 of the connector.
(Quick remark: After modyfing channels and installing the latest version of Jupyter lab (4.0.2) it wasn't displayed on the homescreen of the environment any more. Down-Versioning on 3.5.3 made the trick...)
Kind regards, Rob