I'm using gremlinpython 3.4.1 on Python 3.7.2, and when get vertex/edge responses it is providing <T.id: >
for id and <T.label: 3>
for the label. How would I get it to provide the string value for id and label in the response instead? My aim is take the output and generate JSON
The output:
python3 stackoverflow.py
[{'name': ['USA'], 'parentname': ['USA'], 'shortname': ['US'], <T.id: 1>: 'country-us', 'parentid': ['country-us'], <T.label: 3>: 'Country'}]
The code:
from gremlin_python import statics
from gremlin_python.process.anonymous_traversal import traversal
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.strategies import *
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
from gremlin_python.process.traversal import T
from gremlin_python.process.traversal import Order
from gremlin_python.process.traversal import Cardinality
from gremlin_python.process.traversal import Column
from gremlin_python.process.traversal import Direction
from gremlin_python.process.traversal import Operator
from gremlin_python.process.traversal import P
from gremlin_python.process.traversal import Pop
from gremlin_python.process.traversal import Scope
from gremlin_python.process.traversal import Barrier
from gremlin_python.process.traversal import Bindings
from gremlin_python.process.traversal import WithOptions
CLUSTER_ENDPOINT = "removed"
PORT = "8182"
g = traversal().withRemote(DriverRemoteConnection('wss://' + CLUSTER_ENDPOINT + ':' + PORT + '/gremlin','g'))
response = g.V().has('name', 'USA').limit(1000).hasLabel('Country').valueMap(True).toList()
print(response)
BTW - I have attemped to use .with_(WithOptions.ids)
for example:
response = g.V().has('name', 'USA').limit(1000).hasLabel('Country').valueMap(True).with_(WithOptions.ids).toList()
for which I get the following error:
gremlin_python.driver.protocol.GremlinServerError: 599: {"requestId":"bf74df44-f064-4411-a1cb-78b30f9d2cf6","code":"InternalFailureException","detailedMessage":"Could not locate method: NeptuneGraphTraversal.with([1])"}