【发布时间】:2015-06-04 20:48:57
【问题描述】:
我正在使用 py2neo 从 neo4j 图形数据库中查询一组数据,并在 python 脚本中获得适当信息后创建节点之间的关系。
这是脚本的基本结构。
import py2neo
### get a set of data from a graph database
graph = Graph()
query = graph.cypher.execute("MATCH (p:LABEL1))-[:relationship]->(c:Label2 {Name:'property'} \
RETURN p.Id, p.value1, c.value2 LIMIT 100")
### do a data analysis within a python script here
~ ~ ~
### update newly found information through the analysis to the graph database
tx = graph.cypher.begin()
qs1 = "UNWIND range(0,{size}-1) AS r \
MATCH (p1:Label1 {Id:{xxxx}[r]}),(p2:Label2 {Id:{yyyy}[r]}) \
MERGE (p1)-[:relationship {property:{value}[r]]->(p2)"
tx.append(qs1, parameters = {"size":size, \
"xxxx":xxxx, \
"yyyy":yyyy, \
"value":value})
tx.commit()
当查询结果限制为100时,脚本确实按预期执行,但是当我增加200或以上时,程序崩溃,并留下以下错误消息:
--> 263 tx.commit()
SocketError: 套接字的协议类型错误
不幸的是,除了上面的陈述,没有其他有用的信息可以暗示问题可能是什么。有没有人遇到过这种问题,您能否提出潜在的问题可能是什么?
谢谢。
【问题讨论】:
标签: python sockets neo4j py2neo