我正在尝试从python脚本运行密码查询。函数执行的部分如下所示:
with driver.session() as session:
result = session.run("match (place:{})\
where place.name = \"{}\"\
return (place)"
.format(joined_labels, name))
print ("result = {}".format(result))
for r in result:
print ("r={}".format(r))
它运行良好,并返回一个我可以迭代的neo4j.BoltStatementResult
对象(r
中只有一个result
,它是Node
)。
我希望运行的实际查询是这样:
with driver.session() as session:
result = session.run("match (arch:Person:Architect)-[b:BUILT]->(place:{})\
where place.name = \"{}\"\
return (arch), (place)"
.format(joined_labels, name))
print ("result = {}".format(result))
for r in result:
print ("r={}".format(r))
它也返回一个neo4j.BoltStatementResult
对象,但是我似乎无法对其进行迭代。同时,这两个查询都可以在Neo4j浏览器中正常运行。
该脚本在Ubuntu 18.04上运行,带有python 3.7.5,neo4j 4.0.4和neo4j驱动程序1.7.6。
为什么会这样?
据我所知,没有问题。这就是我和一个愚蠢的错字。