Search code examples
gremlinamazon-neptune

Gremlin with Neptune: How to handle Vertex ID updates?


Case:

A Customer Vertex ~Id requires an update in certain cases.

In the following case, what is the recommended approach to update a Vertex ~id with the New Vertex Id?

Is this possible using an UPSERT or am I better to DELETE the old Vertex and then CREATE a new one assigning the New Vertex Id as ~id?

We have 20 million Vertex and approximately 2% of those will fall into this use case.

Customer Vertex updates

~id New Vertex Id Old Vertex Id
AAA CCC AAA
BBB DDD BBB

Solution

  • @Sascha You can not change the vertex id once created as Taylor Riggan already mentioned. So your option would be to identify those rows and delete them and create new vertexes with new ids.
    If you don't want to delete the old vertexes till new vertexes are created then you set say new attribute named "tobedeleted" to Y for the all identified old vertexes and then you create the new set vertexes and then delete the vertexes where "tobedeleted" property is set to Y.