Reputation: 77
I have a csv file I want to load into a database, but can't seem to have a row as a value for the insert function
for row in readCSV:
cur.execute("INSERT INTO IPaddresses(Start) VALUES(row[0])")
I use the module pymysql
Upvotes: 0
Views: 123
Reputation: 300
What exactly happens when you run the code? Errors? Unexpected values in your table?
Upvotes: 0
Reputation: 300
Not sure why you're not using "load data [local] infile". It'd be much easier. Check out the command here: http://dev.mysql.com/doc/refman/5.0/en/load-data.html and someone with a similar problem here Python/MySQL - LOAD DATA LOCAL INFILE
Upvotes: 1