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

To help you get started, we’ve selected a few aiopg 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 / aiopg / aiopg / sa / transaction.py View on Github external
async def commit(self):
        """Commit this transaction."""

        if not self._parent._is_active:
            raise exc.InvalidRequestError("This transaction is inactive")
        await self._do_commit()
        self._is_active = False
github aio-libs / aiopg / aiopg / 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
        fut = self._pool.release(raw)
        return fut