Wednesday, 11 September 2013

Query to insert column/value from python dict to SQLite database

Query to insert column/value from python dict to SQLite database

How can format a query to insert data from python dictionary to sqlite db ?
Lets say if i hava a table called names i can update it from a
{"first_name":"John"} and it will update only the first_name column and
when i pass {"second_name":"Doe"} it should update the second_name column
only . or if i pass both , it should update them all .
i know i can write INSERT INTO names VALUES(?,?) but i don't understand
how to make it more generic ?

No comments:

Post a Comment