在 gremlin-python 中使用合并和值之间的组合失败

Using a combination between coalesce and values fails in gremlin-python

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

正在执行查询

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

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

我认为您对其不起作用的推理是正确的。进口只是冲突。明确values你想做什么:

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