Python从csv并发更新mysql

Python从csv并发更新mysql,python,mysql,python-3.x,python-2.7,Python,Mysql,Python 3.x,Python 2.7,我有一个非常大的csv,大约100.000行,甚至更多,我需要更新我现有的mysql表(大约10.000个条目)。我尝试了executemany命令,该命令应该一次更新所有内容,但它似乎也在循环。它需要很长时间才能执行,每天需要几个小时。我确实需要一个不同的方法,有没有人有想法加快我的脚本 # -*- coding: utf-8 -*- import csv import MySQLdb params = [] def my_function(zahl): # ope

我有一个非常大的csv,大约100.000行,甚至更多,我需要更新我现有的mysql表(大约10.000个条目)。我尝试了executemany命令,该命令应该一次更新所有内容,但它似乎也在循环。它需要很长时间才能执行,每天需要几个小时。我确实需要一个不同的方法,有没有人有想法加快我的脚本

# -*- coding: utf-8 -*-
import csv
import MySQLdb


params = []
    


def my_function(zahl):

    # open the connection to the MySQL server.
    # using MySQLdb
    
    with open('product_'+zahl+'_de.csv') as csv_file:
        csv_reader = csv.reader(csv_file, delimiter=';')
    # execute and insert the csv into the database.
        
        for row in csv_reader:
            if "PVP_BIG" and "DATE_ADD" in row:
                print "First line removed"
            else:
                params.append([row[20], row[15]])

        
my_function("2202");


mydb = MySQLdb.connect(host='localhost', user='root', passwd='', db='amazonds')
cursor = mydb.cursor()

cursor.executemany("UPDATE scanu SET Stock = %s WHERE EAN13 = %s", params)
cursor.close()