It might be easy, but I am really struggling with this problem. I use gremlin python lib and aws neptune db. I know the vertex id, I just want to get the value(String type in python) of one of the properties of the vertex, and update it.
I have tried to do like this:
print(g.V(event['securityEventManagerId']).values('sourceData'))
print(g.V(event['securityEventManagerId']).property('sourceData'))
print(g.V(event['securityEventManagerId']).property('sourceData').valueMap())
.....
But I just print some python gremlin object like GraphTraversal
, cannot retrieve the value as a string
Can anyone help me out?
You must use a terminal step, without them your query will not execute.
From tinkerpop documentation:
Typically, when a step is concatenated to a traversal a traversal is returned. In this way, a traversal is built up in a fluent, monadic fashion. However, some steps do not return a traversal, but instead, execute the traversal and return a result. These steps are known as terminal steps (terminal) and they are explained via the examples below.
In your case, you should do:
g.V(event['securityEventManagerId']).values('sourceData').next()
Here's a snippet:
for p in g.V(v).properties():
print("key:",p.label, "| value: " ,p.value)
where v is the vertex you want to inspect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With