I am attempting to load csv files into a table in a database using python.
csv_data = csv.reader(file('ppi.csv'))
for row in csv_data:
cursor.execute('INSERT INTO ADKnowledgeBase.PPI(a,b) VALUES("row[0]","row[1]");')
Whenever I run this, I get a warning stating Incorrect Integer Value
and inserts 0's into my table.
When I print row
I get [int0,int1] and they are ints so it's pushing in the ints and not null values.
I've attempted to remove the quotes around "row[0]"
and "row[1]
and instead use VALUES(row[0],row[1]);
but that just gives me a syntax error. I've also attempted using "%d"
and %d
My table was made using:
CREATE TABLE IF NOT EXISTS ADKnowledgeBase.PPI(a int, b int);