It seems we could have connection=None as an optional / implicit argument in the Transaction methods add_auto_id_entity(), begin(), commit() and rollback().
On Connection, the current transaction is used to alter the behavior of the methods, e.g. from commit()
if self.transaction():
request.mode = datastore_pb.CommitRequest.TRANSACTIONAL
request.transaction = self.transaction().id()
else:
request.mode = datastore_pb.CommitRequest.NON_TRANSACTIONAL
It seems instead this separation would benefit by having Transaction subclass Connection and adding the "extra" transaction parts when needed.
Reactions are currently unavailable
It seems we could have connection=None as an optional / implicit argument in the Transaction methods add_auto_id_entity(), begin(), commit() and rollback().
On Connection, the current transaction is used to alter the behavior of the methods, e.g. from commit()
It seems instead this separation would benefit by having Transaction subclass Connection and adding the "extra" transaction parts when needed.