tx().commit() 在 python gremlin 中不工作

tx().commit() not working in python gremlin

在 Python 代码中,我试图从 janusgraph 中删除顶点并在之后提交。但是代码 g.tx().commit() 正在返回 - "exceptions.AttributeError: 'GraphTraversalSource' object has no attribute 'tx'"。 我是否缺少任何进口商品。请提出建议

我试过没有提交,但顶点只是停留在那里,没有从代码返回任何错误

commit 在使用 gremlin 时工作正常 console.issue 从代码中观察到

g.tx().commit()

exceptions.AttributeError: 'GraphTraversalSource' 对象没有属性 'tx'.

gremlinpython 是一种 Gremlin 语言变体,它将您的 Gremlin 翻译成字节码并将其提交到远程服务器以供执行。一旦在服务器上,事务就被视为 "managed",因为每个请求都会自动启动一个事务,然后当请求过程完成时,服务器要么在成功时提交事务,要么在失败时回滚事务。正如您所发现的,您不能(也不需要)直接从 gremlinpython 调用 g.tx()

请考虑通读 TinkerPop Introduction 文档以获取更多信息。