python报“pymysql.err.InternalError: (1364, "Field 'id' doesn't have a default value")”

  I post requests were being given written to the database when using python-flask interface development. "Pymysql.err.InternalError: (1364," Field 'id' does not have a default value ")"

 

the reason:

Database write is unsuccessful, the id value is not written.    

id we are generally designed to be the primary key for the table, not set a primary key when creating a table of increment, resulting in a lack of field content is written.

 

solution:

1, in navicet, find the corresponding database table, right "design table"

 

2, tick increment can be. 

 

 

final effect:

Normal call and write to the database

 

Guess you like

Origin www.cnblogs.com/jsondai/p/11490434.html