I am using neo4j python driver 1.7.4 to issue queries to the db. Some of the queries take longer than the others. So, I am trying to specify a timeout parameter when running sessions/transactions. (I am aware of the global setting in neo4j.conf dbms.transaction.timeout=120s but I want to set the timeout at the transaction level, not at the database level)
Here is my python code but this doesn't seem to work. The below query executes for more than 50 sec and doesn't terminate.
with self._driver.session() as session:
try:
result = session.run("match(p:Person)--(n) return p,count(n)",{"timeout": "50s"})
print(result.single())
except Exception as ex:
print("Exception occurred:" + ex)
Can anyone provide me the correct way to specify timeouts?
The timeout is not an option for session.run. The 2nd argument in the session.run() function is parameters to be passed to the query. ie, if you had MATCH (p:Person) WHERE p.name={name}, then you could pass a dictionary in as the second argument saying {"name": "Kate"} and it would use that value for the query.
Hi
Have the same problem .
I use Ne4j 4.1 with Python.
Have to upload nodes from complex text file . can't create the a CSV since the file will be too complex.
I set in Python the timeout to 200S but any way the upload is stopped after 100 new nodes , and then the session wait idle status till it terminated.
I have the same problem. I'm trying set up a timeout mechanism. I'm using neo4j 3.5 and HTTP API.
I make HTTP requests and get results. When a timeout happens I get empty response. But I can get empty response for a query anyway. So how can I know that if I get a timeout just by looking at HTTP response of neo4j?