How do I insert data from a Python dictionary to MySQL?

Posted by NJTechie on Stack Overflow See other posts from Stack Overflow or by NJTechie
Published on 2010-04-12T15:59:10Z Indexed on 2010/04/12 16:23 UTC
Read the original article Hit count: 345

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about python