update_schema.py 文件源码

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

项目:t2-crash-reporter 作者: tessel 项目源码 文件源码
def update(cls, cursor=None):
        logging.info('Upgrading schema for Crash Reports (Cursor = %s)' % unicode(cursor))
        query = CrashReport.all()
        if cursor:
            query.with_cursor(cursor)

        crash_reports = list()
        for crash_report in query.fetch(limit=BATCH_SIZE):
            crash_report.version = '2'
            crash_report.state = 'unresolved'
            crash_reports.append(crash_report)

        if crash_reports:
            updated = len(crash_reports)
            logging.info('Updating %s entities', updated)
            # update
            db.put(crash_reports)
            Search.add_crash_reports(crash_reports)
            # schedule next request
            deferred.defer(SchemaUpdater.update, cursor=query.cursor())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号