RedisGraph/redisgraph-py

Using Nodes to update existing records

boris-42 opened this issue · 0 comments

Currently, this framework supports only creation of new nodes, but if we want to update some properties, manual requests are required.

As far as I understand, there are 2 approaches here, one through MERGE (to ensure that record exists and update) or MATCH (to update record only if it exists) and it's recommend to use external ids.

The proposal is to add to methods to graph:
def update(node: Node) -> MATCH+ SET
and

def ensure(node: Node) -> MERGE + SET

To do match or merge we need to have ID, which in real life is usually is some UUID from some external system. To solve this we can extend Node.__init__ to allow to pass "id_key" or "id" which will be the name of the property that is use as external id

Is community interested in this kind of change?