Hi Hugo,
I believe your question has already been answered in the
TinkerPop discord. Just to close the loop over here, what you are seeing is a result of Neptune using "set cardinality" for properties instead of "single". If you are using a database which supports TinkerPop 3.7.0 or newer, the correct syntax to specify single cardinality for a property is as follows:
from gremlin_python.process.traversal import Merge, T, CardinalityValue
g.merge_v({T.id_: "x1234"})
.option(Merge.on_create, {T.label: 'Dog', 'name': 'Toby', 'age': 10})
.option(Merge.on_match, {'age': CardinalityValue.single(11)})
.toList()
If it is not possible to upgrade to a database which supports TinkerPop 3.7, then the following example should work. I generally wouldn't recommend using the following syntax unless necessary as it's effectively abusing the onMatch traversal to directly write the updated properties, instead of producing a property map as intended:
g.merge_v({T.id_: "x1234"})
.option(Merge.on_create, {T.label: 'Dog', 'name': 'Toby', 'age': 10})
.option(Merge.on_match, __.side_effect(__.property(Cardinality.single, "age", 11)).constant(dict()))
.toList()
Cole Greer