使用py2neo 2.0在neo4j中批量插入
我编写了这个函数以批量插入数据,但在添加标签时,我得到了BindError:本地实体未绑定到远程实体使用py2neo 2.0在neo4j中批量插入,neo4j,batch-processing,labels,py2neo,Neo4j,Batch Processing,Labels,Py2neo,我编写了这个函数以批量插入数据,但在添加标签时,我得到了BindError:本地实体未绑定到远程实体 def bulkInsertNodes(n=1000): graph = Graph() btch = WriteBatch(graph) nodesList = [] for i in range(1,n+1): temp = Node(id = str(i)) nodesList.append(temp) btc
def bulkInsertNodes(n=1000):
graph = Graph()
btch = WriteBatch(graph)
nodesList = []
for i in range(1,n+1):
temp = Node(id = str(i))
nodesList.append(temp)
btch.create(temp)
btch.run()
btch = WriteBatch(graph)
for n in nodesList:
btch.add_labels(n,"Person")
btch.run()
请包含整个异常堆栈。问题是,我正在使用NodeList中未绑定到远程数据的节点。所以我必须这么做。我已经解决了。谢谢你的回复。def bulkInsertNodesn=1000:graph=graph btch=WriteBatchgraph for i in range1,n+1:btch.createNodeid=stri nodesList=btch.submit btch=WriteBatchgraph for n in nodesList:btch.add_labelsn,Person nodesList=btch.submit