Skip to content

Commit a593cd7

Browse files
authored
return commit_ts in the function 'commit()' in txn.py (#213)
* return commit_ts in the function 'commit()' in txn.py
1 parent 382b5e4 commit a593cd7

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

examples/simple/simple.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ def create_data(client):
7878
response = txn.mutate(set_obj=p)
7979

8080
# Commit transaction.
81-
txn.commit()
81+
commit_response = txn.commit()
82+
print(commit_response)
8283

8384
# Get uid of the outermost object (person named "Alice").
8485
# response.uids returns a map from blank node names to uids.
@@ -106,7 +107,8 @@ def delete_data(client):
106107
print("Bob's UID: " + person['uid'])
107108
txn.mutate(del_obj=person)
108109
print('Bob deleted')
109-
txn.commit()
110+
commit_response = txn.commit()
111+
print(commit_response)
110112

111113
finally:
112114
txn.discard()

pydgraph/txn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def commit(self, timeout=None, metadata=None, credentials=None):
235235

236236
new_metadata = self._dg.add_login_metadata(metadata)
237237
try:
238-
self._dc.commit_or_abort(self._ctx, timeout=timeout,
238+
return self._dc.commit_or_abort(self._ctx, timeout=timeout,
239239
metadata=new_metadata,
240240
credentials=credentials)
241241
except Exception as error:

0 commit comments

Comments
 (0)