当我使用如下脚本运行时:
#coding=utf-8
import MySQLdb
import numpy as np
conn = MySQLdb.connect(host='localhost',port = 3306,user='baidu',passwd='baidu',db='baidu')
cur = conn.cursor()
conn.autocommit(1)
query_sql = "select id from tmp.baiduVideo where created_at < date_sub(now(), interval 1 year);"
insert_sql = "insert ignore into tmp.baiduVideo_bak (select * from tmp.baiduVideo where id = %s);"
delete_sql = "delete from tmp.baiduVideo where id = %s;"
cur.execute(query_sql)
dataList = cur.fetchall()
aaa = np.array(dataList)
ids = []
for i in range(len(aaa)):
ids.append(aaa[i])
if (i+1)%100==0 :
cur.executemany(insert_sql,ids)
ids = []
cur.executemany(insert_sql,ids)
ids = []
for i in range(len(aaa)):
ids.append(aaa[i])
if (i+1)%100==0 :
cur.executemany(delete_sql,ids)
ids = []
cur.executemany(delete_sql,ids)
ids = []
cur.close
conn.close()
这个脚本的目的是把 tmp.baiduVideo 表的 1 年之前的数据归档到 tmp.baiduVideo_bak 表。 当我运行后出现如下错误提示: /usr/lib/python2.7/dist-packages/MySQLdb/cursors.py:206: Warning: Truncated incorrect DOUBLE value: '[2627290]' r = r + self.execute(query, a)
/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py:206: Warning: Truncated incorrect DOUBLE value: '[2627292]' r = r + self.execute(query, a)
/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py:206: Warning: Truncated incorrect DOUBLE value: '[2627295]' r = r + self.execute(query, a)
请问下这个应该如何来解决?