在gremlin-python中使用coalesce和values之间的组合会失败

问题描述 投票:0回答:1

我正在尝试投影节点中可能不存在的属性。根据文档,这可以通过使用与值的合并来实现。

执行查询

g.V(1).project('unexisting').by(coalesce(values('unexisting'), constant('n/a')))

请注意,查询在gremlin控制台中成功运行

gremlin> g.V(1).project('unexisting').by(coalesce(values('unexisting'), constant('n/a')))
==>[unexisting:n/a]

虽然与gremlin-python库一起使用时出错但是有错误

TypeError: 'Column' object is not callable

我认为这是因为使用时导入values作为en Enum导入

from gremlin_python import statics

我应该如何重新构造查询以使其通过?谢谢

python gremlin tinkerpop
1个回答
1
投票

我认为你为什么不起作用的原因是正确的。进口只是相互矛盾。明确你想要和做的values

g.V(1).project('unexisting').by(coalesce(__.values('unexisting'), constant('n/a')))
© www.soinside.com 2019 - 2024. All rights reserved.