Results 1 to 2 of 2
  1. #1
    Join Date
    May 2014

    Unanswered: how to store a python-dictionary into a mysql-database

    i have a dictionary - THIS IS obviously a python dictionary

    an this has approx 8 000 lines with records


    $ python
    {'url': 'http://www.site1_com', 'cname': 'butcher', 'name': 'cheng', 'email': ''}
    {'url': 'http://www.site2_com', 'cname': 'dilbert', 'name': 'James', 'email': ''}

    i have a mysql-db up and runing in my opensuse

    there i have created a db with the fields


    i use the

    import MySQLdb

    i studied this documentation here: How do I connect to a MySQL Database in Python? - Stack Overflow

    but i think this goes a bit over my head.

    - well how can i get the data ( in other words the dictionary) into the database?

    love to hear from you


  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    either insert rows directly from a python script
    or import using a tools such as MySQL Workbench,PHPMyAdmin

    if you are unable to follow the installation of the python mysql driver + libraries then perhaps do some more googling on the subject

    as to how you iterate through the python dictionary thats a python question and we don't have a python forum here
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts