Skip to content
Advertisement

UPDATE SQLite database from Python not working as expected

I want to perform an UPDATE? on a SQLite database from Python (2.7). This is the table`

JavaScript

and this is how I want to insert rows

JavaScript

However, when I do a SELECT * FROM foo it the result set is zero rows.. There is not data in there. Why?

Advertisement

Answer

It sounds like you want to insert here, not update:

JavaScript

Note that there is a cursor#executeMany() function which you also might be able to use here, to avoid one/both of the above loops.

Advertisement