vesoft-inc / nebula

A distributed, fast open-source graph database featuring horizontal scalability and high availability
https://nebula-graph.io
Apache License 2.0
10.72k stars 1.2k forks source link

DML(update) after pipeline #2938

Open wey-gu opened 3 years ago

wey-gu commented 3 years ago

Is your feature request related to a problem? Please describe.

Describe the solution you'd like Support this:

(root@nebula) [basketballplayer]> LOOKUP ON player | UPDATE VERTEX ON player $-.VertexID SET age = age + 0
[ERROR (-1004)]: SyntaxError: syntax error near `UPDATE'

Mon, 27 Sep 2021 10:23:58 CST
(root@nebula) [basketballplayer]> LOOKUP ON player WHERE player.name == "Tim Duncan" YIELD id(vertex) AS id | UPDATE VERTEX ON player $-.id SET age=1 YIELD age
[ERROR (-1004)]: SyntaxError: syntax error near `UPDATE'

Tue, 23 May 2023 14:03:33 CST

(root@nebula) [basketballplayer]> $var = YIELD "player999" AS vid;UPDATE VERTEX ON player $var.id SET age=1 YIELD age
[ERROR (-1004)]: SyntaxError: Variable is not supported in vid near `$var'

Describe alternatives you've considered Or so other expressions which make more sense than I wasn't aware of?

Additional context

https://discuss.nebula-graph.com.cn/t/topic/5911

wey-gu commented 2 years ago

More discussion here: https://nebulagraph.slack.com/archives/CJNFUM7AR/p1654647502447089

jjsimps commented 2 years ago

My use case: Batch update edge/vertex properties allowing pipelining. For my particular use-case, I wish to set a flag for certain edges that meet certain traversal conditions

Something like: GO FROM "user1", "user2" OVER in_group WHERE dst(edge) != "group1" YIELD src(edge) AS src, dst(edge) AS dst, rank(edge) AS rank | UPDATE EDGE ON in_group $-.src -> $-.dst @ $-.rank SET is_active = false;

Currently I have to bring back the result of GO FROM ... to the application level, then generate UPDATE EDGE commands.

wey-gu commented 2 years ago

@MuYiYong

Could we add support on this?

This is a missing piece on updating data based on property conditions in Nebula Graph as we only have ready cypher support for now.

MERGE (keanu:Person {name: 'Keanu Reeves'})
ON CREATE
  SET keanu.created = timestamp()
ON MATCH
  SET keanu.lastSeen = timestamp()
RETURN keanu.name, keanu.created, keanu.lastSeen
wey-gu commented 2 years ago

image

this was requested today.

cc @MuYiYong

chenweisomebody126 commented 1 year ago

In the cypher query, a lookup followed by an update is allowed in the format of "match (v: vertice)where v.property 1== value1, set v.property2= value2.". I am looking forward to a similar functionality to be supported.

wey-gu commented 1 year ago

update: it seems the variable in UPDATE/INSERT is already supported, but just not supported in the VID field

(root@nebula) [(none)]> $var = YIELD "player999" AS vid;UPDATE VERTEX ON player $var.id SET age=1 YIELD age
[ERROR (-1004)]: SyntaxError: Variable is not supported in vid near `$var'

Fri, 26 May 2023 15:06:57 CST
wey-gu commented 1 year ago

Are you interested in this? @RAJVARDHAN2486

RAJVARDHAN2486 commented 1 year ago

@wey-gu Yes I am interested , I am starting my work

yinhang-e5b0b9e888aa commented 1 month ago

这个功能有排期吗?

zhanghuidinah commented 2 weeks ago

Hi @RAJVARDHAN2486 The new year's hacktoberfest for developers has started. If you're interested, you're welcome to join us.