In the docs under Updating a Vertex Property, it is mentioned that one can "update a property value without adding an additional value to the set of values"
by doing
g.V('exampleid01').property(single, 'age', 25)
In gremlin_python, I am unable to run a query like the above.
I get the error:
update_prop_overwrite = g.V().hasLabel('placeholder-vertex').property(single,'maker','unknown').next()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'single' is not defined
How can I resolve this so that I can replace a Vertex property value in Neptune?
Without single the query will append the new property value to the property key if a value exists already.
You need to be sure to import single which is seen here in the code and can be imported with:
from gremlin_python.process.traversal import Cardinality
however TinkerPop documentation recommends importing all such classes with:
statics.load_statics(globals())
You can read more about that here.
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