struck at sqlalchemy.exc.IntegrityError: (IntegrityError) constraint failed 'INSERT INTO users

て烟熏妆下的殇ゞ 提交于 2019-12-05 10:56:52

In table users you have defined column id as primary key. However, in your INSERT statement you do not provide id.

That would be totally fine if id was auto-increment column - but it is not.

Solution is to add sqlite_autoincrement=True into your users table definition.

Also, your users table definitions seems to be too strict - you require most fields to be non-nullable. It depends on your task, but sometimes being too strict can be bad idea - it will also cause constraint violation if you forgot (or simply don't want) to fill one of those fields.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!