GremlinforPython返回遍历命令列表,而不是数据

GremlinforPython返回遍历命令列表,而不是数据,python,aws-lambda,gremlin,amazon-neptune,gremlinpython,Python,Aws Lambda,Gremlin,Amazon Neptune,Gremlinpython,我正在尝试使用AWS Lambda函数w/Python 3.7访问我的Neptune DB。对于一个非常简单的测试,我的lambda中有以下代码 g = graph.traversal().withRemote(DriverRemoteConnection('ws://[endpoint]:8182/gremlin','g')) g.addV('student').property('name', 'Jeffery').property('GPA', 4.0) stud

我正在尝试使用AWS Lambda函数w/Python 3.7访问我的Neptune DB。对于一个非常简单的测试,我的lambda中有以下代码

    g = graph.traversal().withRemote(DriverRemoteConnection('ws://[endpoint]:8182/gremlin','g'))
    g.addV('student').property('name', 'Jeffery').property('GPA', 4.0)

    students = g.V('student').values('name')
    print(numVert)
在尝试了许多不同的遍历之后,我从print语句中得到的唯一值是 [['V'、'student']、['values'、'name']]或我想要执行的命令的类似列表表示,而不是像Jeffrey这样的数据本身


我是否遗漏了一些明显的错误?我已经试着用toList指定我想要的结果,但这没有帮助。谢谢

使用Gremlin from code时,您需要始终使用终端步骤(如toList、next或iterate等)结束查询。您看到的只是查询/遍历的字节码到字符串形式,因为由于缺少终端步骤,查询没有实际执行。搜索学生时,还需要使用hasLabel。V步骤采用一个或多个ID的可选列表,而不是标签

g.addV('student').property('name', 'Jeffery').property('GPA', 4.0).next()
students = g.V().hasLabel('student').values('name').toList()
print(students)
下面是使用Gremlin Python运行的查询

>>> g.addV('student').property('name', 'Jeffery').property('GPA', 4.0).next()
v[9eb98696-d979-c492-ab2d-a36a219bac6c]

>>> students = g.V().hasLabel('student').values('name').toList()

>>> print(students)
['Jeffery']

当使用Gremlin from代码时,您需要始终使用终端步骤(如toList、next或iterate等)结束查询。您看到的只是查询/遍历的字节码到字符串形式,因为由于缺少终端步骤,查询没有实际执行。搜索学生时,还需要使用hasLabel。V步骤采用一个或多个ID的可选列表,而不是标签

g.addV('student').property('name', 'Jeffery').property('GPA', 4.0).next()
students = g.V().hasLabel('student').values('name').toList()
print(students)
下面是使用Gremlin Python运行的查询

>>> g.addV('student').property('name', 'Jeffery').property('GPA', 4.0).next()
v[9eb98696-d979-c492-ab2d-a36a219bac6c]

>>> students = g.V().hasLabel('student').values('name').toList()

>>> print(students)
['Jeffery']

太好了,非常感谢你的帮助。这些都是你从小精灵医生那里得到的吗?我还没有找到一个关于gremlin的页面,上面清楚地描述了每个功能,或者你需要用一个终端步骤结束任何查询。看看这加上链接的GitHub站点是否有帮助:太好了,非常感谢你的帮助。这些都是你从小精灵医生那里得到的吗?我还没有找到一个关于gremlin的页面,该页面清楚地描述了每个功能,或者您需要用一个终端步骤结束任何查询。看看这加上链接的GitHub站点是否有帮助: