0

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

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

is it still possible to do it the other way ?
@JesperPetersen If you're using MySQLDb, see stackoverflow.com/questions/18128870/…
0

What exactly happens when you run the code? Errors? Unexpected values in your table?

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.