Neo4j: Create multiple relationships with cypher and parameters -
i try create lot of relationships (16k) 1 cypher statement , parameters in py2neo writebatch. if try create 10 (or so) relationships, works without problems. 16k relationships, neo4j server hung @ 100% cpu , py2neo gives error (after while).
i use following code create relationships:
graph_db_batch = neo4j.writebatch(graph_db) graph_db_batch.append_cypher\ (\ "\ foreach (par in {params} |\ merge (s:users {userid1:par.sval})-[r:member_of]->(e:groups {groupid:par.eval})\ set r = par.cprops\ );\ ",\ object_props\ ) graph_db_batch.run()
object_props looks this:
{'params': [{'sval': 'usera', 'cprops': {'marked': 1, 'datedeleted': 0}, 'eval': 'groupx'}, {'sval': 'userb', 'cprops': {'marked': 1, 'datedeleted': 0}, 'eval': "groupy"}]}
Comments
Post a Comment