python db.session.commit()的时候出现FlushError错误,,python db.se
python db.session.commit()的时候出现FlushError错误,,python db.se
python db.session.commit()的时候出现FlushError错误class Epg_ps(db.Model): __tablename__='epg_ps' id = db.Column(db.String(50),primary_key=True) pos_left =db.Column(db.Integer) pos_top =db.Column(db.Integer) pos_width =db.Column(db.Integer) pos_height =db.Column(db.Integer) epg_type=db.Column(db.Integer,db.ForeignKey('area_type.id')) def __repr__(self): return '<Epg_ps %s>' % self.idclass Epg_areaType(db.Model): __tablename__='area_type' id=db.Column(db.Integer,primary_key=True) name=db.Column(db.String(50),unique=True) type=db.Column(db.Integer,unique=True) ps=db.relationship('Epg_ps',backref='type',lazy='dynamic') def __repr__(self): return '<area_type %>' % self.nameadd=Epg_ps(id='regions_1',pos_left=34,pos_top=43,pos_width=43,pos_height=34,epg_type=1)
执行下面的代码的时候就
db.session.add(add)db.session.commit()
抛出
FlushError: Instance <Epg_ps at 0x7ffca0959950> has a NULL identity key. If this is an auto-generated value, check that the database table allows generation of new primary key values, and that the mapped Column object is configured to expect these generated values. Ensure also that this flush() is not occurring at an inappropriate time, such aswithin a load() event.
编橙之家文章,
相关内容
- 七牛下载链接出现{"error":"download token auth failed"
- 相同硬件不同编程语言,它们的区别是什么呢?,硬件
- python里面为什么系统的时区是东八,但是存数据还是存
- django1.8 出现NoReverseMatch错误怎么解决?,,django1.8 出现
- django读取日志并写入db数据库中,怎么样用页面展示出
- python3 类型Type str doesn't support the buffer API?,python3buffe
- Tornado里面self.write("hello")出现"Broken pipe Error"怎么
- requests爬取代理网站ip验证,登陆ip网站查询ip不变的原
- 用python将序列化之后的 json 存储在 mysql 中并且对于开发
- 编程语言的选择: Why choose Ruby or Python over PHP for web dev
评论关闭