2

I try to create a lot of relationships (16k) with one cypher statement and parameters in py2neo by a WriteBatch. If try to create only 10 (or so) relationships, it works without problems. But with 16k relationships, the Neo4j server hung at 100% CPU and py2neo gives an error (after a while).

I use the following code to create the 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 like this:

    {'params': [{'sval': 'userA', 'cprops': {'marked': 1, 'datedeleted': 0}, 'eval': 'groupX'}, {'sval': 'userB', 'cprops': {'marked': 1, 'datedeleted': 0}, 'eval': "groupY"}]}
4

0 回答 0