sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1366, "Incorrect string value: '\\xE6\\xB1\\x89\\xE8\\xAF\\xAD...' for column 'className' at row 1") [SQL: INSERT INTO classmessage (`classId

sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1366, "Incorrect string value: '\\xE6\\xB1\\x89\\xE8\\xAF\\xAD...' for column 'className' at row 1")
[SQL: INSERT INTO classmessage (`classId`, `className`, xq, `useOrNot`, `increaseTime`) VALUES (%(classId)s, %(className)s, %(xq)s, %(useOrNot)s, %(increaseTime)s)]
[parameters: {'classId': '16010101', 'className': '汉语言文学1601', 'xq': '1', 'useOrNot': 1, 'increaseTime': datetime.datetime(2019, 10, 18, 23, 12, 47, 147040)}]
(Background on this error at: http://sqlalche.me/e/2j85)





解决办法:
数据库属性设置成utf8

数据库里的表属性也设置utf8

你可能感兴趣的:(sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1366, "Incorrect string value: '\\xE6\\xB1\\x89\\xE8\\xAF\\xAD...' for column 'className' at row 1") [SQL: INSERT INTO classmessage (`classId)