I want to insert a dictionary a = {'key': 602L} into DB in python. It does not allows me to insert it because of the quotes'' in key.
Here is my query
self.__db_conn.cursor.execute("INSERT INTO TABLE VALUES ('%s')" % (str(a)))
If I manually try to insert it(without quotes), it does work.
self.__db_conn.cursor.execute("INSERT INTO TABLE VALUES ('%s')" % ("{key: 602L}"))
Note the missing quotes in key.
How do I insert a dictionary into a table.?