def __init__(self, client, transaction_id='TRANSACTION'): from google.cloud.datastore.batch import Batch from google.cloud.datastore.transaction import Transaction self._client = client xact = self._transaction = Transaction(client) xact._id = transaction_id Batch.begin(xact)
class _NoCommitBatch(object): def __init__(self, client): from google.cloud.datastore.batch import Batch self._client = client self._batch = Batch(client) self._batch.begin() def __enter__(self): self._client._push_batch(self._batch) return self._batch def __exit__(self, *args): self._client._pop_batch()
def batch(self): """Proxy to :class:`google.cloud.datastore.batch.Batch`.""" return Batch(self)
def __init__(self, client): from google.cloud.datastore.batch import Batch self._client = client self._batch = Batch(client) self._batch.begin()