1

I have been trying to use py2neo to read from my neo4j database and in particular I want to execute the following cypher query,

MATCH (node {name:"shoes"})-[r]->(n) RETURN r,n; //This works well in cypher-shell

Now the equivalent of this query using py2neo would be the following,

g.run("MATCH (node {name:$nodename})-[r]->(n) RETURN r,n",parameters={"nodename":"shoes"}).data()

However, executing the above query gives me an error, something like this,

py2neo.database.ClientError: SyntaxError: The old parameter syntax '{param}' is no longer supported. Please use '$param' instead (line 1, column 25 (offset: 24)) "MATCH (_) WHERE id(_) = {x} RETURN _, labels(_)"

But I am using the $ convention in my query above correctly. This is because if I run the same query with my parameter value empty, I get no error and py2neo returns me an empty list,

g.run("MATCH (node {name:$nodename})-[r]->(n) RETURN r,n",parameters={"nodename":""}).data() //This runs fine and returns []

Can someone throw light on this issue? My py2neo version is 4.3.0 (Ideally I would not want to change to another version)

mettleap
  • 1,390
  • 8
  • 17

1 Answers1

0

Try to use a WHERE clause instead of inline filter. Maybe py2neo has a problem with that.

MATCH (node)-[r]->(n)
WHERE node.name = $nodename
RETURN r,n
Tomaž Bratanič
  • 6,319
  • 2
  • 18
  • 31