Neo4J 的创建、拉取和 create_unique

Neo4J's create, pull, and create_unique

我们正在使用 Neo4J 和 Python (py2neo)。我可以确认 graph.create()graph.pull()graph.create_unique() 都是 "commit" 他们的作品,用 SQL 说话吗?他们似乎确实如此,但现在不是假设的正确时间。

我读过 this page 但我没有看到像 "permanently" 这样的关于写作的词。在 SQL 数据库中,一个未提交的事务看起来是永久的,而另一个在事务中...

您可以通过使用 py2neowatch:

来准确了解发生了什么
>>> from py2neo import watch, Graph, Node
>>> watch("httpstream")
>>> graph = Graph()
>>> nicole = Node("Person", name="Nicole")
>>> graph.create(nicole)
> POST http://localhost:7474/db/data/cypher [80]

所以你可以看到 graph.create 正在使用 legacy Cypher endpoint。如果你想使用事务端点,你最好使用事务:

>>> tx = graph.cypher.begin()
>>> tx.append("CREATE (n:Person) SET n = {props}", props={"name":"Nicole"})
>>> tx.commit()
> POST http://localhost:7474/db/data/transaction/commit [137]

这分明就是用了transactional endpoint.