What\'s the best way to store and retrieve a python dict in a database?
"Best" is debatable.
If you need a DBMS, sqlite is built in; so it might be considered an easier method than some of the other ways mentioned.
import sqlite3
conn = sqlite3.connect(':memory:')
c = conn.cursor()
c.execute("create table kv (key text, value integer);")
#
d = {'a':1,'b':2}
c.executemany("insert into kv values (?,?);", d.iteritems())
#
c.execute("select * from kv;").fetchall()
# [(u'a', 1), (u'b', 2)]