作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 docs在更新顶点属性下,提到可以“更新属性值而不向值集中添加附加值”通过做g.V('exampleid01').property(single, 'age', 25)
在 gremlin_python 中,我无法运行上述查询。
我收到错误:
update_prop_overwrite = g.V().hasLabel('placeholder-vertex').property(single,'maker','unknown').next()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'single' is not defined
如何解决此问题,以便替换 Neptune 中的 Vertex 属性值?
如果没有 single
,如果值已经存在,查询会将新的属性值附加到属性键。
最佳答案
您需要确保导入看到的single
here in the code并可以通过以下方式导入:
from gremlin_python.process.traversal import Cardinality
但是 TinkerPop 文档建议使用以下方式导入所有此类类:
statics.load_statics(globals())
您可以阅读更多相关信息 here .
关于gremlin - 在 gremlin_python 中更新属性值而不添加附加值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52528911/
在 docs在更新顶点属性下,提到可以“更新属性值而不向值集中添加附加值”通过做 g.V('exampleid01').property(single, 'age', 25) 在 gremlin_py
在 docs在更新顶点属性下,提到可以“更新属性值而不向值集中添加附加值”通过做 g.V('exampleid01').property(single, 'age', 25) 在 gremlin_py
自定义 ID 可以在 Gremlin 控制台中提供给新顶点,如下所示: gremlin> g.addV('person').property(id, 1234).next() ==>v[1234] 在
我是一名优秀的程序员,十分优秀!