init_categories.py 文件源码

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

项目:OilLibrary 作者: NOAA-ORR-ERD 项目源码 文件源码
def link_all_other_oils(session):
    '''
        Category Name:
        - Other
        Sample Oils:
        - Catalytic Cracked Slurry Oil
        - Fluid Catalytic Cracker Medium Cycle Oil
        Criteria:
        - Any oils that fell outside all the other Category Criteria
    '''
    _top, categories = get_categories_by_names(session, 'Other',
                                               ('Other',))

    oils = (session.query(Oil)
            .filter(Oil.categories == None)
            .all())

    count = 0
    for o in oils:
        o.categories.extend(categories)
        count += 1

    logger.info('{0} oils added to {1}.'
                .format(count, [n.name for n in categories]))
    transaction.commit()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号