How do I insert data from a Python dictionary to MySQL?
- by NJTechie
I manipulated some data from MySQL and the resulting dictionary "data" (print data) displays something like this :
{'1': ['1', 'K', abc, 'xyz', None, None, datetime.date(2009, 6, 18)],
'2': ['2', 'K', efg, 'xyz', None, None, None, None],
'3': ['3', 'K', ijk, 'xyz', None, None, None, datetime.date(2010, 2, 5, 16, 31, 2)]}
How do I create a table and insert these values in a MySQL table? In other words, how do I dump them to MySQL or CSV? Not sure how to deal with datetime.date and None values. Any help is appreciated.