Save bulk data in database

Hello everyone,
I am trying to save data in local database.

  1. I am trying to store data directly :
    curs = connection.cursor()
    result = cHandler.fetchall()
    for row in result:
    rt= row
    print (rt)
    curs.execute(“INSERT INTO table (UserId, C1) VALUES (%s, %s)”, row)

  2. Also trying to import data from csv file :
    c = csv.writer(open(‘file.csv’, ‘wb’))
    for x in result:
    c.writerow(x)

csv_data = pd.read_csv(‘file.csv’,header=None,delim_whitespace=True)
for row in csv_data:
print csv_data
curs.execute(“INSERT INTO testo (UserId, C1) VALUES (%s, %s)”, row)
Getting this error(ValueError: No columns to parse from file)

Thanks in advance.

It would help if you posted some data from your CSV file. Perhaps it is missing the header records.