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
would like support of eq/le/lt/ge/gt in mutation conditional upsert other than existing len function only #5281
Comments
I think it works only with Length function. Correct me If I'm wrong. But I'm pretty sure about it, as I saw that code borning. So move your Check to an intermediate block. e.g:
There is something curious about its mutation. You say "create NodeB node if doesn't exist based on nodeA timestamp". But you are using an existing UID from "eb12". I was confused by this. Upsert Block will create a node if it doesn't exist. I didn't understand why you are collecting an existing UID and saying that you are going to create a new one. |
@MichelDiz Thx for your reply. I only shared snippet of logic. We have need to check for existing timestamp to decide if needs to create new node or not. Moving timestamp check to intermediate block option should work, will try.
Yes, we also observed this. Can we fix it? This will help to write neat code and also bring more power on conditional upsert. |
I am also facing a similar issue. Consider a type
If I wanted to upsert values based on events that might be out of order, I'd like to be able to perform a query as follows
Now the funny thing is the above will actually update the value of I understand that As I see it now, the only option to achieve the behavior I'm looking for would be to add a query for every conditional upsert I want to make like Please let us know if there is any way to support a more robust set of functions for conditional mutations, thank you in advance for you consideration. |
I understand perfectly that it is a logical leap to think that the mutation block parameter field would accept inequality functions and other functions in See, parameters at root is used to evaluate the entity itself. A mutation does not have an entity, it is used to create an entity not to find one. So it doesn't make sense for a parameter in something that doesn't yet exist. If we are going to adopt any That's my two cents about what happened and what I think. If you really want this, you should upvote (like) the main comment (the issue itself). To show interest. Without movement, your issue goes unnoticed or not prioritized. @dilipkumar2k6 I think you should update your issue showing that you understand that there is no support for this and wishes for it. This makes it easier for the engineer, so he doesn't have to read every conversation and understand what's going on. No need to erase what was there before, just add a note. By the way, this conversation should have been done at https://discuss.dgraph.io/. Because there we have a better search engine than Github, this would help other users to understand and participate in the discussion. Anyway, I will accept it in the backlog. Cheers. |
@MichelDiz thx for your response. I updated issue to reflect what you suggested. |
Oh, that's really great! Your PR will be welcome! @lgalatin FYI about the contribution from @dilipkumar2k6. As I have accepted it, maybe we should have a separated thing or remove it from Jira. |
Once @dilipkumar2k6 PR is submitted and reviewed and accepted, the Jira ticket will automatically close. We will not work on it (thank you @dilipkumar2k6 ). |
I believe I have a use case for this. I have nodes with fields that should only increase/ decrease. When I get new data I have to first check "Is the node's property higher than the new data, or lower" and then perform the logic to update if necessary. There are also properties that should never update - I want to avoid performing a write if the property is already set. |
Github issues have been deprecated. |
What version of Dgraph are you using?
dgraph:v20.03.0
Have you tried reproducing the issue with the latest release?
Already using latest version
What is the hardware spec (RAM, OS)?
MAC OS, 32GB RAM
Steps to reproduce the issue (command/config used to run Dgraph).
Expected behaviour and actual result.
conditional
upsert
should work find on field other thanuid
.Sample example given at following document is using
uid
only. In my case, I want to applyval
on the predicateuid
and then compare with corresponding value, but its not working.https://dgraph.io/docs/master/mutations/#example-of-multiple-mutation-blocks
The text was updated successfully, but these errors were encountered: