-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support a new Upsert operation #3059
Comments
that would be great one thing,
|
@makitka2007 |
i see, but in case of insert - what does for update it's ok, i was talking about first case (insert) only |
Inside the |
nope, in first case you are checking for |
You're right, then I'm not sure what that means. |
The first PR is ready, but blocked by API changes. The syntax changed a bit to not interfere with IRI values. Also, the query is treated as a conditional so if there are no matches and/or no vars generated the mutation won't happen. To test you need the branch in #3197 and dgraph-io/dgo#50 Ex:
Additionally, when using |
I think something like this could work too.
If there are more than 0 values in v, then, we will do a simple update mutation. If not, in the case, we will generate new UIDs and run the mutations. |
Just for my clarification, will this allow me to use a single round trip to perform multiple unrelated transactions? I have a use case where I receive N node 'descriptions', and I need to create or update. Right now I use a single transaction for all of them - but this means that if any fails, it's treated as a total transaction failure. I want each node create/update to be its own transaction, with only a single round trip. Based on the syntax this doesn't seem like it's the case, because the |
Notes from discussion:
|
Should we support multiple mutations in one request? For example -
|
Depends upon the internal code complexity. It is marginally more useful than just having one mutation block. But, if the code complexity is disproportionately large, then probably not for the first cut. |
This operation would allow a user to run a query, and use its results (via variables) to execute the mutation. This would then allow upserts to happen, without doing multiple network calls to the DB.
This txn would check for an account with
[email protected]
, and only if it is present, wouldit run the mutation.
This should return the result of query, normally. And also return the result of the mutation.
Additionally, we should be able to optionally do the mutation, iff the email is already present.
This would introduce a new txn operator, and a new if directive applicable for mutations.
The text was updated successfully, but these errors were encountered: