pydgraph icon indicating copy to clipboard operation
pydgraph copied to clipboard

adding txn.upsert rough draft

Open Kingloko opened this issue 4 years ago • 5 comments

This is a rough draft, a place to start a conversation. Hopefully this can be useful in upstream


This change is Reviewable

Kingloko avatar Sep 16 '19 18:09 Kingloko

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Sep 16 '19 18:09 CLAassistant

I actually think the wrapper has three major advantages (on top of the normal ease of use) a) its easier for new users to quickly find. Personally, I had to search through the unit tests to figure out how to use the new upsert stuff, and if I was newer to dgraph I am not sure if I would have been able to find the feature as quickly as I did. b) It fits within the existing design, txn.mutate and txn.query have wrappers so logically a new type of interaction should have its own new wrapper. c) [could be related to a] it makes the code more readable, if I was a new contributor to a team that uses dgraph it would be immedietly clear what txn.upsert().

Ultimately, this is your guys' product so you get the final say, this is just my two cents. As always, I appreciate the continuous support and quick responses.

Kingloko avatar Sep 16 '19 19:09 Kingloko

query and mutate exist as wrappers for backwards-compatibility reasons. My main issue with this wrapper is that we try to get the different clients to be as close as possible. So if the wrapper is useful, we should decide whether to bring it on every client. I'll bring up this discussion with the rest of the team to see what they think.

If you have specific complains about the upsert documentation, could you open an issue in the dgraph repo?

martinmr avatar Sep 16 '19 20:09 martinmr

query and mutate exist as wrappers for backwards-compatibility reasons. My main issue with this wrapper is that we try to get the different clients to be as close as possible. So if the wrapper is useful, we should decide whether to bring it on every client. I'll bring up this discussion with the rest of the team to see what they think.

That's a great point, keeping the APIs equivalent is something I hadn't considered. I'll update the PR with the information you all asked for later this week.

Thanks for the quick review!

Kingloko avatar Sep 16 '19 21:09 Kingloko

@Kingloko We do not plan to add this in the library but we could add this as a test or an example. If you could raise a PR with that, would be happy to look at it.

mangalaman93 avatar Oct 01 '19 15:10 mangalaman93