简体   繁体   English

Gremlin with Neptune:如何处理 Vertex ID 更新?

[英]Gremlin with Neptune: How to handle Vertex ID updates?

Case:案件:

A Customer Vertex ~Id requires an update in certain cases.客户顶点~Id在某些情况下需要更新。

In the following case, what is the recommended approach to update a Vertex ~id with the New Vertex Id ?在以下情况下,使用新顶点 ID更新顶点~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?这可能使用UPSERT还是我最好删除旧顶点然后创建一个新顶点并将新顶点 ID分配为〜id

We have 20 million Vertex and approximately 2% of those will fall into this use case.我们有 2000 万个 Vertex,其中大约 2% 将属于这个用例。

Customer Vertex updates客户顶点更新

~id ~编号 New Vertex Id新顶点 ID Old Vertex Id旧顶点 ID
AAA AAA级 CCC CCC 认证 AAA AAA级
BBB BBB DDD DDD BBB BBB

Vertex IDs in Neptune are immutable. Neptune 中的顶点 ID 是不可变的。 If this is something that you need to change on a regular basis, then you'll want to make it a property instead.如果这是您需要定期更改的内容,那么您将希望将其设为属性。

@Sascha You can not change the vertex id once created as Taylor Riggan already mentioned. @Sascha 您不能像 Taylor Riggan 已经提到的那样更改顶点 ID。 So your option would be to identify those rows and delete them and create new vertexes with new ids.因此,您的选择是识别这些行并删除它们并创建具有新 ID 的新顶点。
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.如果在创建新顶点之前不想删除旧顶点,则为所有已识别的旧顶点设置名为“tobedeleted”的新属性为 Y,然后创建新的集合顶点,然后删除“tobedeleted”所在的顶点" 属性设置为 Y。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM