Jump to content


Photo

storing values of a request in a MySQL - database (an easy one)


  • Please log in to reply
1 reply to this topic

#1 apollo_moon_driver

apollo_moon_driver

    Newbie

  • New Members
  • Pip
  • 7 posts

Posted 06 July 2014 - 06:29 AM

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'}

[code=auto:0]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...abase-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



#2 QuickOldCar

QuickOldCar

    Advanced Member

  • Members
  • PipPipPip
  • 1,846 posts
  • LocationNorthEast Pennsylvania

Posted Today, 01:58 AM

Have a look at Mysql Connector/Python

 

MySQL Connector/Python enables Python programs to access MySQL databases

 

Coding examples


DynaIndex.com
Dynamic search index of websites, links, feeds, title, description, keywords and thumbnail snapshot.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com