seed.py 文件源码

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

项目:game_recommendations 作者: ceorourke 项目源码 文件源码
def set_val_user_id():
    """Set value for the next user_id after seeding database"""

    # Get the Max user_id in the database
    result = db.session.query(func.max(User.user_id)).one()
    max_id = int(result[0])

    # Set the value for the next user_id to be max_id + 1
    query = "SELECT setval('users_user_id_seq', :new_id)"
    db.session.execute(query, {'new_id': max_id + 1})
    db.session.commit()


#*****************************************************************************#
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号