2 Replies
Say I have a entity called company with definition
Now when I insert data into this graph, I want to do upsert.
Reasons is, I might have multiple data sources for the same company-id, and yet each source only contributes to one of the many fields owned by company.
Say source A has company-id: 1, name: "ABC Limited"
And source B has company-id:1, founded-on "2025-01-01"
Then I feel the easiest way is to write upsert, based on company-id as key.
=============
I read about
put
keyword. However, the doc says that put
is basically
- match all the patterns of a given thing. If all fields match, then do nothing. Otherwise, if partially matched or not matched at all, insert.
So, it looks like that I cannot specify that "just look at the company-id field when doing matching`.
So what would be the correct way to do upsert?
Or if upsert is not possible, what's the recommended approach to solve this?The reference gives an example: "To achieve the desired result of not re-creating the person if only the age attribute is missing, put stages can be pipelined."
I assume this is what you want - attach the
founded-on
to the company with company-id
== 1, if it exists (but create the company if it does not exist)