【问题标题】:can not use 'is(inside())' or has(id,inside()) in gremlin_python不能在 gremlin_python 中使用 'is(inside())' 或 has(id,inside())
【发布时间】:2019-05-08 07:55:46
【问题描述】:

我想使用 gremlin_python 获取范围内键的数据。
它适用于 gremlin.sh:
g.V().values('timestamp').is(inside(1557298800.0,1557295200.0))

g.V().has('timestamp',inside(1557298800.0,1557295200.0))
但是当我在 python 中使用g.V().values('timestamp').is(1557298800.0).toList() 时, 'is'下报错SyntaxError: invalid syntax
当我在 python 中使用g.V().has('timestamp',inside(1557298800.0,1557295200.0)).toList() 时, 报错NameError: name 'inside' is not defined
现在,如何在 gremlin_python 中使用 python 中的范围查询?

【问题讨论】:

    标签: python gremlin


    【解决方案1】:

    Python 中的is() 步骤与is Python 关键字冲突,因此您必须将其称为is_(),如here 所述。我假设对于inside(),您只需要按照here 的讨论进行导入P.inside()

    【讨论】:

    • 谢谢。现在我有另一个问题,当我在python中使用inside()时,它似乎只支持10位以内的数字。如果数字超过10位,就像inside(15573600000,15573708000),a错误报告为KeyError: None。但我可以在 gremlin.sh 中使用相同的语法
    • 指定为inside(long(15573600000),long(15573708000))
    猜你喜欢
    • 2022-11-09
    • 2021-11-02
    • 1970-01-01
    • 2020-10-03
    • 2016-08-04
    • 2013-05-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多