简体   繁体   中英

How to delete relationships in Neo4j using python neo4j-rest-client library?

I am not able to find the API to delete relationships from a Node, I could only find a create method. Please let me know how I can delete it.

Don't know exactly about the python library but my understanding is that it mimics the Java API.

In Java API you'd use:

for (Relationship r: myNode.getRelationships()) {
    r.delete();
}

I guess the same concept is valid for python's neo4jrestclient as well: get all relationships of a node and call the delete() method on them.

That's exactly right:

rel = n1.relationships.create("Knows", n2)
rel.delete()

And that's it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM