How to write upsert query for edge ?

28 views
Skip to first unread message

Suyog Kale

unread,
Nov 6, 2016, 10:53:32 PM11/6/16
to OrientDB
How to write upsert query for edge that if it exist then update else insert, Please give me sample examples. few forums observed that developers has issues that it adds multiple edges.

user.w...@gmail.com

unread,
Nov 7, 2016, 2:38:14 AM11/7/16
to orient-...@googlegroups.com
Hi,

try this:

update link SET out = #22:0, in = #21:0 UPSERT WHERE out = #22:0 and in = #21:0

Hope it helps

Regards,
Michela

Suyog Kale

unread,
Nov 7, 2016, 4:29:33 AM11/7/16
to OrientDB
Hi Michela,
I got following error:
error com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error parsing query:\nUPDATE LINK

I am using graph DB, I am not sure if we can use Update EDGE with Upsert.  OR update Link is right syntax.

Suyog Kale

unread,
Nov 7, 2016, 4:32:31 AM11/7/16
to orient-...@googlegroups.com
I am able to upsert for edge class with following syntax:

UPDATE LikeComment SET out = #21:21, in = #20:20 UPSERT WHERE out = #21:21 and in = #20:20

But When I select source vertex like SELECT FROM #21:21 it does not show me that out edge in result.

user.w...@gmail.com

unread,
Nov 7, 2016, 4:39:51 AM11/7/16
to OrientDB
Hi,

link is the name of my edge so, you have to do:

UPDATE LikeComment SET out = #21:21, in = #20:20 UPSERT WHERE out = #21:21 and in = #20:20

Hope it helps

Regards,
Miichela

Suyog Kale

unread,
Nov 7, 2016, 4:48:12 AM11/7/16
to OrientDB
I am able to upsert for edge class with following syntax:

UPDATE LikeComment SET out = #21:21, in = #20:20 UPSERT WHERE out = #21:21 and in = #20:20

But When I select source vertex like SELECT FROM #21:21 it does not show me that out edge in result.


user.w...@gmail.com

unread,
Nov 7, 2016, 5:16:05 AM11/7/16
to OrientDB
Hi,

can you open an issue?

Thx.

Regards,
Michela

Oleksandr Gubchenko

unread,
Nov 7, 2016, 5:22:20 AM11/7/16
to OrientDB

Suyog Kale

unread,
Nov 7, 2016, 6:44:49 AM11/7/16
to OrientDB
Ya, logged the issue.
Reply all
Reply to author
Forward
0 new messages