0
votes

To create and save a Node in Neo4J using py2Neo. We do.

tx = graph.begin():
node = Node('Label', property='A'})
tx.create(node) 

As far as create a node with multiple labels. The documentation seems quiet. Is something possible along the lines.

tx = graph.begin()
node = Node(*labels, **properties)
tx.create(node)   # possible

Or do we have to resort to cyper.run to use raw cypher.

Thanks.

1

1 Answers

0
votes

You can just supply the labels as extra arguments:

from py2neo import Graph, Node
graph = Graph(password="password")

tx = graph.begin()
node = Node("Label1", "Label2", property="A")
tx.create(node)
tx.commit()

enter image description here