Coming from Neo4J cypher's implementation, I could do the following:
q = '''
UNWIND $rows as row
MATCH (g_child:Group {uid: row.child_uid})
MATCH (g_parent:Group {uid: row.parent_uid})
MERGE (g_child)-[:CHILD_GROUP_OF]->(g_parent)
RETURN count(*) as total
'''
and then
res = neo4j.query(q, parameters = {'rows': r})
This would take a list of dictionaries as rows and unwind them on the server, lighting fast.
Is there any similar way of doing this with AGE? I've looked through documentation and the source code and it doesn't seem to be an option. The closest one is use
with ag.connection.cursor() as cursor:
and perform multiple single calls within that cursor, committing at the end.
This is quite slow on large volumes of data (testing on 500K vertices).
Separately, what is the suggested way to UPSERT the data (MERGE in Neo4j implementation)? Or do we need to manually verify for existence/duplicate before creating?
Coming from Neo4J cypher's implementation, I could do the following:
and then
res = neo4j.query(q, parameters = {'rows': r})This would take a list of dictionaries as rows and unwind them on the server, lighting fast.
Is there any similar way of doing this with AGE? I've looked through documentation and the source code and it doesn't seem to be an option. The closest one is use
with ag.connection.cursor() as cursor:and perform multiple single calls within that cursor, committing at the end.
This is quite slow on large volumes of data (testing on 500K vertices).
Separately, what is the suggested way to UPSERT the data (MERGE in Neo4j implementation)? Or do we need to manually verify for existence/duplicate before creating?