def begin_transaction(self, project): """Begin a transaction. Maps the ``DatastoreService.BeginTransaction`` protobuf RPC. :type project: string :param project: The project to which the transaction applies. :rtype: bytes :returns: The serialized transaction that was begun. """ request = _datastore_pb2.BeginTransactionRequest() response = self._datastore_api.begin_transaction(project, request) return response.transaction
def begin_transaction(self, dataset_id): """Begin a transaction. Maps the ``DatastoreService.BeginTransaction`` protobuf RPC. :type dataset_id: string :param dataset_id: The ID dataset to which the transaction applies. :rtype: bytes :returns: The serialized transaction that was begun. """ request = _datastore_pb2.BeginTransactionRequest() request.isolation_level = ( _datastore_pb2.BeginTransactionRequest.SERIALIZABLE) response = self._rpc(dataset_id, 'beginTransaction', request, _datastore_pb2.BeginTransactionResponse) return response.transaction