I want to fetch all the edges and associated vertices from my AWS Neptune DB. In addition, I want the id, labels and properties for the nodes as well as edges.
My data is a stored as a property graph and I'm using gremlin-python to query it.
Below is a query which provides the required data when executed in the gremlin shell. However, trying to execute the same using gremlin-python throws an error.
g.V().bothE().otherV().limit(2).path().by(__.valueMap(true))
Python variant
from gremlin_python import statics
from gremlin_python.structure.graph import Graph
from gremlin_python.process.traversal import T
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.strategies import *
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
# Define a graph instance
graph = Graph()
# Connect to the neptune instance
try:
remoteConn = DriverRemoteConnection('wss://<YOUR_NEPTUNE_IP>:8182/gremlin', 'g')
g = graph.traversal().withRemote(remoteConn)
except:
print("Couldn't connect successfully with Neptune instance")
exit()
g.V().bothE().otherV().limit(2).path().by(__.valueMap(True))
Error
GremlinServerError: 498: {"requestId":"...","code":"UnsupportedOperationException","detailedMessage":"org.apache.tinkerpop.gremlin.process.traversal.step.util.ImmutablePath cannot be cast to org.apache.tinkerpop.gremlin.structure.Element"}
Can someone provide me a way to get the required information? Be it by successfully converting the above query to Python or via some other query.