繁体   English   中英

如何获取neo4j查询中更新的节点总数?

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM