billygoat
billygoat

Reputation: 21984

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.

Upvotes: 0

Views: 464

Answers (2)

Javier de la Rosa
Javier de la Rosa

Reputation: 669

That's exactly right:

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

And that's it.

Upvotes: 1

Stefan Armbruster
Stefan Armbruster

Reputation: 39905

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.

Upvotes: 1

Related Questions