c.execute('create table kv (key text, value integer);')
d = {'a': 1, 'b': 2}
c.executemany('insert into kv values (?,?);', iter(d.items()))
c.execute('select * from kv;').fetchall()
Python, store a dict in a database