def insert(result):
logging.debug("开始写入")
conn = pymysql.connect(host=host, port=3306, user=user, passwd=passwd, db=db, charset='utf8')
logger.debug('Get connection successfully')
cursor = conn.cursor()
sql = "INSERT INTO journal_article(recid, Keywords, Keywords_extend) VALUES (%s,%s,%s)"
cursor.executemany(sql, result)
conn.commit()
cursor.close()
conn.close()
批量插入mysql数据库函数
最新推荐文章于 2024-08-29 11:43:27 发布