[英]How can I get the number of nodes of a Neo4j graph database from Python?
[英]How to get the total number of nodes updated in a neo4j query?
在python中运行密码查询后,我想获取通过查询更新的节点数。 我该怎么办?
如果您将Neo4j Bolt Driver 1.6用于Python,则需要consume
函数:
print(session.run("MERGE (a:TEST {name: rand()})").consume().counters)
// {'labels_added': 1, 'nodes_created': 1, 'properties_set': 1}
更新 :如果使用旧库neo4jrestclient
(不再主动开发),则使用变量stats
(并指定选项data_contents=True
):
print(gdb.query("MERGE (a:TEST {name: rand()})", data_contents=True).stats)
// {u'relationship_deleted': 0, u'constraints_added': 0, u'labels_added': 1,
// u'labels_removed': 0, u'nodes_created': 1, u'properties_set': 1, u'nodes_deleted': 0,
// u'constraints_removed': 0, u'indexes_removed': 0, u'contains_updates': True,
// u'relationships_created': 0, u'indexes_added': 0}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.