sql.py 文件源码

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

项目:livebridge 作者: dpa-newslab 项目源码 文件源码
def get_last_updated(self, source_id):
        try:
            db = await self.db
            table = self._get_table()
            result = await db.execute(
                table.select().where(
                    table.c.source_id == source_id
                ).order_by(
                    table.c.updated.desc()
                ).limit(1))
            item = await result.first()
            tstamp = item["updated"] if item else None
            return tstamp
        except Exception as exc:
            logger.error("[DB] Error when querying for last updated item on {}".format(source_id))
            logger.exception(exc)
        return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号