postgresqlconn.py 文件源码

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

项目:heroku-python-boilerplate 作者: chavli 项目源码 文件源码
def execute_write_query(self, query: str, args: tuple = ()) -> int:
        """ perform a write query

        query -- the query string with optional %s placeholders
        args -- optional tuple of values for %s placeholders

        returns number of rows modified
        """
        if not self.__conn:
            raise psycopg2.InterfaceError("null connection")

        try:
            with self.__conn.cursor() as curs:
                curs.execute(query, args)
        except Exception as e:
            tb.print_exc()
            raise(e)

        return curs.rowcount
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号