how to store a python-dictionary into a mysql-database?

Einfach Dinge, die nichts mit XAMPP, Apache Friends, Apache, MySQL, PHP und alle dem zu tun haben. Allerlei halt. ;)

how to store a python-dictionary into a mysql-database?

Postby unleash » 06. July 2014 12:02

i have a dictionary - THIS IS obviously a python dictionary

an this has approx 8 000 lines with records


[/CODE]


$ python printer.py
{'url': 'http://www.site1_com', 'cname': 'butcher', 'name': 'cheng', 'email': 'mail1@hotmail.com'}
{'url': 'http://www.site2_com', 'cname': 'dilbert', 'name': 'James', 'email': 'mail2@hotmail.com'}




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

there i have created a db with the fields

url
cname
name
email



i use the

import MySQLdb

i studied this documentation here: http://stackoverflow.com/questions/3728 ... -in-python

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

greetings
unleash
 
Posts: 147
Joined: 03. December 2011 10:16
Operating System: OpenSuse Linux 12.1

Re: how to store a python-dictionary into a mysql-database?

Postby Nobbie » 07. July 2014 14:58

You must write a program which does the job. There is no "one-click" solution.
Nobbie
 
Posts: 13179
Joined: 09. March 2008 13:04

Re: how to store a python-dictionary into a mysql-database?

Postby unleash » 07. July 2014 23:47

hello dear Nobnbie

many thanks for the answer. i will digg deeper and driy out how it woks!`?

i have had a closer look at tifferent ORM-based solutions. A objectrect recpdording solution

- SQLAlchemy.
- peewee - leightweight


well i come back later te week and report all my findings

Again many thanks norbii
unleash
 
Posts: 147
Joined: 03. December 2011 10:16
Operating System: OpenSuse Linux 12.1


Return to Allerlei

Who is online

Users browsing this forum: No registered users and 84 guests