Skip to content

adding txn.upsert rough draft #89

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

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
adding txn.upsert rough draft
  • Loading branch information
Kingloko committed Sep 16, 2019
commit 1c1aeec0d2cf6e8567c88bc59593d02f1c66f5a7
14 changes: 14 additions & 0 deletions pydgraph/txn.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ def __init__(self, client, read_only=False, best_effort=False):
self._read_only = read_only
self._best_effort = best_effort




def upsert(self, query, variables=None, mutation=None, set_obj=None, del_obj=None,
set_nquads=None, del_nquads=None, cond=None, commit_now=None,
timeout=None, metadata=None, credentials=None):
"""Executes a mutate operation."""
mutation = self.create_mutation(mutation, set_obj, del_obj, set_nquads, del_nquads, cond)
commit_now = commit_now or mutation.commit_now
req = self.create_request(query=query, variables=variables, mutations=[mutation], commit_now=commit_now)
return self.do_request(req, timeout=timeout, metadata=metadata, credentials=credentials)



def query(self, query, variables=None, timeout=None, metadata=None, credentials=None):
"""Executes a query operation."""
req = self.create_request(query=query, variables=variables)
Expand Down