錯誤記錄:Data too long for column 'xxx' at row 1
使用Flask-sqlalchemy操作資料時報錯: "Data too long for column 'chapter_list' at row 1"
在網上找了很久,發現不是編碼問題,也不是字符集的問題,
于是根據報錯提示同時測驗一下資料長度,發現是:125968(Text是6萬多),果然超標了,于是上網找長欄位,發現了還有其他的欄位,對應MEDIUMTEXT,LONGTEXT
方法:
from sqlalchemy.dialects.mysql import MEDIUMTEXT
from sqlalchemy.dialects.mysql import LONGTEXT
替換原來的db.Text
里面還有很多的mysql欄位,可以找自己需要的
我的github
我的博客
我的筆記
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/158890.html
標籤:Python
上一篇:python(Redis 中 Set/Zset 型別資料和其他操作)
下一篇:matplotlib part1
