科探空谷
  • Home
  • zhimind home
  • Categories
  • Tags
  • Archives
  • 留学
    • 学校库
    • 专业库
    • 研究方向与招生
    • 工具
    • GPA计算器
    • 脑洞背单词
    • 脱口而出

SQLAlchemy遇到IntegrityError

[TOC]

模板

try:
    tag_obj = query_add_interests(tag, major)
    if professor and tag_obj:
        professor.interests.append(tag_obj)
        db.session.flush()
except IntegrityError:
    db.session.rollback()

介绍

  1. db.session.flush()
  2. db.session.rollback()

参考

flush

this man is lazy, nothing left

Comments
comments powered by Disqus

Published

9月 6, 2017

Category

数据库

Tags

  • SQLAlchemy 1

Stay in Touch

  • Powered by Pelican. Theme: Elegant by Talha Mansoor