import dataset import codecs import dataset import json db = dataset.connect('mysql://hhh7796hhh:lYmWsu^ujcA1@127.0.0.1:13317/xoops?charset=utf8mb4') db2 = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4') table=db2['columnids'] cursor=db.query('SELECT * FROM xoops._hcolumn where datediff(now(),creat_time) < 300') for c in cursor: table.insert({'cid':c['hcolumn_id']})