You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Similar use case when using MERGE in Cypher.
If we would like to query in one shoot(instead of two queries) to create a user tag vertex only when its email property was not associated with any existing user vertices.
Describe the solution you'd like
Some expression to enable conditionally insert? The easy way/ugly may be to:
a) add parsing rule on variable support in INSERT VERTEX?
b) add pipe support in INSERT VERTEX?
(root@nebula) [basketballplayer]> $var = LOOKUP ON user WHERE user.email == "Rudy.Gay@domain.tld" YIELD user.email as email | \
-> GROUP BY $-.email YIELD $-.email as email, count(*) AS number | \
-> YIELD CASE $-.number == 0 WHEN true THEN "user200" ELSE "userdummy" END AS user_vid;
+-------------+
| user_vid |
+-------------+
| "userdummy" |
+-------------+
Got 1 rows (time spent 4169/44468 us)
a)
$var = LOOKUP ON user WHERE user.email == "Rudy.Gay@domain.tld" YIELD user.email as email | \
GROUP BY $-.email YIELD $-.email as email, count(*) AS number | \
YIELD CASE $-.number == 0 WHEN true THEN "user200" ELSE "userdummy" END AS user_vid;
insert vertex user(email) values $var.user_vid:("Rudy.Gay@domain.tld")
(root@nebula) [basketballplayer]> $var = LOOKUP ON user WHERE user.email == "Rudy.Gay@domain.tld" YIELD user.email as email | \
-> GROUP BY $-.email YIELD $-.email as email, count(*) AS number | \
-> YIELD CASE $-.number == 0 WHEN true THEN "user200" ELSE "userdummy" END AS user_vid; \
-> insert vertex user(email) values $var.user_vid:("Rudy.Gay@domain.tld")
[ERROR (-1004)]: SyntaxError: syntax error near `$var'
Mon, 19 Jul 2021 17:37:29 CST
b)
(root@nebula) [basketballplayer]> LOOKUP ON user WHERE user.email == "Rudy.Gay@domain.tld" YIELD user.email as email | \
-> GROUP BY $-.email YIELD $-.email as email, count(*) AS number | \
-> YIELD CASE $-.number == 0 WHEN true THEN "user200" ELSE "userdummy" END AS user_vid |\
-> insert vertex user(email) values $-.user_vid:("Rudy.Gay@domain.tld")
[ERROR (-1004)]: SyntaxError: syntax error near `insert'
Mon, 19 Jul 2021 17:43:05 CST
Describe alternatives you've considered
Cypher MERGE support? or other smart expressions to enable the condition based on the property of an insert.
Is your feature request related to a problem? Please describe.
Similar use case when using
MERGE
in Cypher.If we would like to query in one shoot(instead of two queries) to create a
user tag
vertex only when its email property was not associated with any existing user vertices.Describe the solution you'd like
Some expression to enable conditionally insert? The easy way/ugly may be to:
INSERT VERTEX
?INSERT VERTEX
?a)
b)
Describe alternatives you've considered
Cypher
MERGE
support? or other smart expressions to enable the condition based on the property of an insert.Additional context
https://discuss.nebula-graph.com.cn/t/topic/3457
https://nebulagraph.slack.com/archives/CJNFUM7AR/p1626558554041700
The text was updated successfully, but these errors were encountered: