Reputation: 3642
I'm using this code in Python:
for ... :
cursor.execute('INSERT OR IGNORE INTO foo (bar,baz) VALUES (?, ?)',(1,3))
con.commit()
Can I get the value of the number of rows that have been inserted without using if
statement and testing if the value existed before insert?
Upvotes: 1
Views: 290
Reputation: 21851
To get number of rows inserted, cursor.rowcount
should return the number of rows affected by the last execute ( in this case, number of inserts).
Upvotes: 2