As outlined here https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-differences.html custom vertex ids can only be set with the unquoted id
property, i.e., g.addV('label1').property(id, 'customid')
. How can one accomplish this using the gremlinpython package? I see an id
function in gremlin_python.process.graph_traversal
, but I get an UnsupportedOperationException
(as expected) when attempting to use that.
You should just have to import T
which is the class that hold the id
and label
members:
from gremlin_python.process.traversal import T
then use it as:
g.addV('label1').property(T.id, 'customid').iterate()
You can of course choose to import id
from T
so as to make the syntax synonymous with the example Gremlin in your question such that you may omit the T
- some folks prefer that style.
It may be worth looking at the reference documentation for other common imports that Gremlin uses.
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