Reputation: 11
I want to get some path by using py2neo but I didn't find the right way, so I choose to use graph.run(), when I run the statements below:
t='T1018'
path1=graph.run("MATCH path=(m:attack{name:t})-[:next*1..2]->(n:attack) return path").to_series()
It will show error like this:
py2neo.errors.ClientError: [Statement.SyntaxError] Variable `t` not defined (line 1, column 27 (offset: 26))
"MATCH path=(m:attack{name:t})-[:next*1..2]->(n:attack) return path"
So how can I use the python variables in a cypher statement? Or is there a way to get paths using py2neo statements? ^
Upvotes: 1
Views: 144
Reputation: 415
pass the arguments like as follows:
t='T1018'
path1=graph.run("""MATCH path=(m:attack{name:$x})-[:next*1..2]->(n:attack) return path""",x=t).to_series()
Upvotes: 1