asyncpg.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:asyncqlio 作者: SunDwarf 项目源码 文件源码
def execute(self, sql: str, params: typing.Mapping[str, typing.Any] = None):
        """
        Executes SQL inside the transaction.

        :param sql: The SQL to execute.
        :param params: The parameters to excecute with.
        """
        # re-paramatarize the query
        logger.debug("Executing query {} with params {}".format(sql, params))
        query, params = get_param_query(sql, params)

        try:
            results = await self.acquired_connection.execute(query, *params)
        except (asyncpg.IntegrityConstraintViolationError,
                asyncpg.exceptions.NotNullViolationError) as e:
            raise IntegrityError(*e.args) from e
        except asyncpg.ObjectNotInPrerequisiteStateError as e:
            raise OperationalError(*e.args) from e
        except (asyncpg.SyntaxOrAccessError, asyncpg.InFailedSQLTransactionError) as e:
            raise DatabaseException(*e.args) from e

        return results
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号