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

frlan
  • 6,950
  • 3
  • 31
  • 72
Jesper Petersen
  • 77
  • 3
  • 10

2 Answers2

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

Community
  • 1
  • 1
user2301506
  • 290
  • 5
  • 11
0

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

user2301506
  • 290
  • 5
  • 11