def begin(self): if self.transaction_id: raise dbexceptions.NotSupportedError( 'Nested transactions not supported') req = self._make_req() try: response = self.client.call('SqlQuery.Begin', req) self.transaction_id = response.reply['TransactionId'] except gorpc.GoRpcError as e: raise convert_exception(e, str(self))
def begin(self): if self.in_transaction: raise dbexceptions.NotSupportedError( 'Cannot begin: Already in a transaction') req = self._make_req() try: response = self.client.call('Barnacle.Begin', req) self.in_transaction = True except gorpc.GoRpcError as e: raise convert_exception(e, str(self))
def begin(self, effective_caller_id=None): _ = effective_caller_id if self.transaction_id: raise dbexceptions.NotSupportedError('Nested transactions not supported') req = { 'ImmediateCallerID': {'Username': self.caller_id}, 'SessionId': self.session_id } try: response = self.rpc_call_and_extract_error('SqlQuery.Begin2', req) self.transaction_id = response.reply['TransactionId'] except (gorpc.GoRpcError, TabletError) as e: raise convert_exception(e, str(self))