pip install py2neo
python
from py2neo import Graph, Node, Relationship
python
graph = Graph("bolt://localhost:7687", username="neo4j", password="password")
python
node = Node("Label", property1="value1", property2="value2")
python
graph.create(node)
python
relationship = Relationship(start_node, "RELATIONSHIP_TYPE", end_node, property="value")
python
graph.create(relationship)
python
result = graph.nodes.get(property=value)
python
results = graph.nodes.match("Label", property=value)
python
results = graph.match(start_node, "RELATIONSHIP_TYPE", end_node)
python
node["property"] = "new_value"
graph.push(node)
python
relationship["property"] = "new_value"
graph.push(relationship)
python
graph.delete(node)
python
graph.delete(relationship)
python
with graph.begin() as tx:
tx.run("CREATE (n:Node {property: value})")
python
graph.run("CREATE (n:Node {property: value})")