为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:8
【操作系统】:Win11
【CPU】:
【问题描述】*:SQLAlchemy框架下,表自增列为id,插入数据时,id 不赋值,报错:sqlalchemy.orm.exc.FlushError: Instance <Contract at 0x28eb8ab65d0> 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 as within a load() event,数据没有插入成功,但是在sql下使用sql语句插入,ID不赋值可以成功插入数据,该怎么操作?
按你上篇改了default然后也是这样,大佬解决了吗?
可以看下数据的SQL日志,你这个SQL到数据库层面了吗
具体开启查看数据库SQL日志方法如下:
https://eco.dameng.com/community/article/dfaaa74e6575b0fc759565e818a3f5d2