Doing this in a single operation may not have a well defined behaviour. Not a good idea, technically, it should not fail but final output is not guaranteed to be the same.
The reason I asked is that if I run the delete first and the upsert later, and the upsert fails, my data gets corrupted.
I understand dgraph does not include the concept of scalable “transactions” that can include multiple sequences of interspersed queries and mutations inside them and are run either-all-or-nothing. Is this correct?
We do have client side transactions. You can use a transaction to do the delete, followed by update and after that, commit the transaction. You’ll get exactly what you want. Let us know if you need more help.
I am not sure how would I bunch the delete and the upsert transactions into one atomic safe “client side” transaction. Any guideline is useful actually .