Update edge with upsert should cover case like:
NodeObj vertex has unique index on qName.
ImpactEdge vertex has unique index on edgeId.
Running commands
CREATE VERTEX NodeObj CONTENT {"tD":1,"qName":"1.101.4.2881","cT":1531588634559} ;
CREATE VERTEX NodeObj CONTENT {"tD":1,"qName":"1.101.4.3620","cT":1531588634559} ;
UPDATE Edge ImpactEdge SET out = ( SELECT FROM NodeObj where qName='1.101.4.2881') , in = ( SELECT FROM NodeObj where qName='1.101.4.3620') , edgeId= '1.101.4.2881_1.101.4.3620_9223372036854775807' UPSERT WHERE edgeId = '1.101.4.2881_1.101.4.3620_9223372036854775807' .
should create a edge between two vertices if doesn't exists and update IN and OUT fields on the vertices as well.
It creates the edge and sets the @rid properly within the edge but its not updating the IN and OUT fields on the vertices and thus breaks the graph.
Running the above commands should re-create the scenario.
Please look into this issue as well it has become a major bottleneck for us. https://github.com/orientechnologies/orientdb/issues/8427 thanks!
+1
I have also encountered this bug.
It is a major bottleneck for us too and it has forced us to fallback to far less performant solutions.
Hi @TariqAHassan @gtadudeps
UPSERT is available in v 3.0 but only to create/update an edge between two vertices (ie. avoid to re-create an edge between the same two vertices), and not to change the out, in properties.
Thanks
Luigi
@luigidellaquila
Thanks for the fast reply.
I know you folks are swamped with work, but I was just wondering if you foresee this being added at some point in the future? I ask because I'm trying to determine if we should implement the current workaround we have for achieving this functionality, or hold off for a bit.
Thanks for all of your amazing work.
@luigidellaquila - UPSERT isn't documented in UPDATE EDGE for 3.0 or 3.1. Should I add that to my list of changes for the docs I already said I'd do? :smiley:
Scott
Hi @smolinari
Thank you very much, I saw it and added it to my TODO list already, but if you have a chance to do it, it will be very appreciated ;-)
Thanks
Luigi
The current implementation is definitely useful as a way to easily prevent duplicate edges between the same two vertexes, but I agree that UPSERT should work as described by the OP.
my temporary solve:
./bin/console.sh "connect remote:localhost/SN1 root rootpwdasdf; TRUNCATE CLASS GroupToUser unsafe;" > /dev/null;
echo "removed GroupToUser: OK"
./bin/console.sh "connect remote:localhost/SN1 root rootpwdasdf; TRUNCATE CLASS UserToGroupunsafe" > /dev/null;
echo "removed UserToGroup: OK"
echo "Start..."
./bin/console.sh "connect remote:localhost/SN1 root rootpwdasdf; set ignoreErrors true; load script ./source/groupsUsers.osql" > ./source/logfile.txt;
set ignoreErrors true; – is very important
after then need rebuild index and all is ok
We are use CREARE EDGE
I not try, but found it: http://orientdb.com/docs/3.1.x/console/Console-Command-Repair-Database.html
Maybe can help. Not sure.
Most helpful comment
Please look into this issue as well it has become a major bottleneck for us. https://github.com/orientechnologies/orientdb/issues/8427 thanks!