C:\Users\Administrator\venv\lib\site-packages\pymysql\cursors.py:170: Warning: (1265, "Data truncated for column '前百分比' at row 1")
result = self._query(query)
C:\Users\Administrator\venv\lib\site-packages\pymysql\cursors.py:170: Warning: (1265, "Data truncated for column '后百分比' at row 1")
result = self._query(query)
C:\Users\Administrator\venv\lib\site-packages\pymysql\cursors.py:170: Warning: (1265, "Data truncated for column '现百分比' at row 1")
result = self._query(query)
数据来源杂,量大,而且写入是多线程,
1265 这种告警,又并非是一种异常错误,用 try,except,print 大法也无法捞出具体是怎么样的数据被自动切长短,
尽管表的字段长度都调过了进行适配,依然会偶然跳一下 1265 告警,于是只能怀疑数据来源处理得有些不干净,
又不好定位是什么原因。。。
from dbutils.pooled_db import PooledDB
POOL = PooledDB(xxx)
DBconn = POOL.connection()
cur = DBconn.cursor()
cur.execute(sqlcmdtext)
cur.close()
DBconn.close()
1
johnsona 2020-11-15 16:10:22 +08:00 via iPhone
mongodb
|
2
wuwukai007 2020-11-15 18:19:27 +08:00 via Android
入库前对数据做一下长度检验呢
|
3
liprais 2020-11-15 18:31:01 +08:00 via iPhone
strict mode 会抛异常
|
4
xuanbg 2020-11-15 19:14:08 +08:00
前百分比这个字段的内容长度超了啊。写入前校验一下数据长度,把超长的 log 出来看看不就知道啦。
|
5
lolizeppelin 2020-11-16 10:35:14 +08:00
关键词 warning filter
|