How to use the aiomysql.sa.exc.InvalidRequestError function in aiomysql

To help you get started, we’ve selected a few aiomysql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aio-libs / aiomysql / aiomysql / sa / engine.py View on Github external
def release(self, conn):
        """Revert back connection to pool."""
        if conn.in_transaction:
            raise InvalidRequestError("Cannot release a connection with "
                                      "not finished transaction")
        raw = conn.connection
        return self._pool.release(raw)
github aio-libs / aiomysql / aiomysql / sa / exc.py View on Github external
This error generally corresponds to construction time state errors.
    """


class InvalidRequestError(ArgumentError):
    """aiomysql.sa was asked to do something it can't do.

    This error generally corresponds to runtime state errors.
    """


class NoSuchColumnError(KeyError, InvalidRequestError):
    """A nonexistent column is requested from a ``RowProxy``."""


class ResourceClosedError(InvalidRequestError):
    """An operation was requested from a connection, cursor, or other
    object that's in a closed state."""
github aio-libs / aiomysql / aiomysql / sa / transaction.py View on Github external
def prepare(self):
        """Prepare this TwoPhaseTransaction.

        After a PREPARE, the transaction can be committed.
        """

        if not self._parent.is_active:
            raise exc.InvalidRequestError("This transaction is inactive")
        yield from self._connection._prepare_twophase_impl(self._xid)
        self._is_prepared = True
github aio-libs / aiomysql / aiomysql / sa / exc.py View on Github external
class ArgumentError(Error):
    """Raised when an invalid or conflicting function argument is supplied.

    This error generally corresponds to construction time state errors.
    """


class InvalidRequestError(ArgumentError):
    """aiomysql.sa was asked to do something it can't do.

    This error generally corresponds to runtime state errors.
    """


class NoSuchColumnError(KeyError, InvalidRequestError):
    """A nonexistent column is requested from a ``RowProxy``."""


class ResourceClosedError(InvalidRequestError):
    """An operation was requested from a connection, cursor, or other
    object that's in a closed state."""