I tried to run the query below:
edge = g.V(id).addE("rated").to(g.V(n_id)).next()
but I am getting the error
InvalidRequest: Error from server: code=2200 [Invalid query] message="Could not read the traversal from the request sent. Error was: Could not locate method: DefaultGraphTraversal.addE([rated, [GraphStep(vertex,[{source_id=34897306, source_system=MSI_CLIENT, ~label=person}])]])"
Both g.V(id) and g.V(n_id) is returning vertices and I don't see any issues with that. Can some one please let me know why I am facing above error ?
gremlinpython has a quirk which prevents you from nesting traversals within other traversals in this way. When you nest
V()within a traversal, you must use the__class like so:__.V(). You can import the__class asfrom gremlin_python.process.graph_traversal import __.The below code should work: