Spaces:
Runtime error
Runtime error
File size: 762 Bytes
c8047a5 b245237 11213cb b245237 11213cb b245237 11213cb b245237 11213cb b245237 11213cb b245237 11213cb b245237 11213cb b245237 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
from . import driver
def match_person_nodes(tx, uid1: str, uid2: str):
tx.run('MERGE (p1:Person {uid: "' + uid1 + '"})')
tx.run('MERGE (p2:Person {uid: "' + uid2 + '"})')
tx.run(
'MATCH (p1:Person {uid: "'
+ uid1
+ '"}) MATCH (p2:Person {uid: "'
+ uid2
+ '"}) MERGE (p1)-[:FRIEND]-(p2)'
)
async def insert2PersonAndSetFriend(uid1: str, uid2: str):
with driver.session() as session:
session.write_transaction(match_person_nodes, uid1, uid2)
async def deleteFriend(uid1: str, uid2: str):
await driver.execute_query(
'MATCH (p1:Person {uid: "'
+ uid1
+ '"})-[r:FRIEND]-(p2:Person {uid: "'
+ uid2
+ '"}) DELETE r'
)
|