def start_transaction(self, read_concern=None, write_concern=None,
                          read_preference=None):
        """Start a multi-statement transaction.

        Takes the same arguments as :class:`TransactionOptions`.

        .. versionadded:: 3.7
        """
        self._check_ended()

        if self._in_transaction:
            raise InvalidOperation("Transaction already in progress")

        read_concern = self._inherit_option("read_concern", read_concern)
        write_concern = self._inherit_option("write_concern", write_concern)
        read_preference = self._inherit_option(
            "read_preference", read_preference)

        self._transaction.opts = TransactionOptions(
            read_concern, write_concern, read_preference)
        self._transaction.reset()
        self._transaction.state = _TxnState.STARTING
        self._start_retryable_write()
        return _TransactionContext(self)
def start_transaction ( self , read_concern = None , write_concern = None , read_preference = None ) : self . _check_ended ( ) if self . _in_transaction : raise InvalidOperation ( "Transaction already in progress" ) read_concern = self . _inherit_option ( "read_concern" , read_concern ) write_concern = self . _inherit_option ( "write_concern" , write_concern ) read_preference = self . _inherit_option ( "read_preference" , read_preference ) self . _transaction . opts = TransactionOptions ( read_concern , write_concern , read_preference ) self . _transaction . reset ( ) self . _transaction . state = _TxnState . STARTING self . _start_retryable_write ( ) return _TransactionContext ( self )
Start a multi-statement transaction.

        Takes the same arguments as :class:`TransactionOptions`.

        .. versionadded:: 3.7