#!/usr/bin/python
import MySQLdb
import sys
import time
db = MySQLdb.connect(host="reportsdb",user="root", db="tool_metrics")
dbc = db.cursor()
str = "select '1','2','3'";
dbc.execute(str)
records = dbc.fetchall()
for r in records:
print r[0]+","+r[1]+","+r[2]
For more information on Python and databases I recommend the following book for futher reading: Python Pocket Reference (Pocket Reference (O'Reilly))
No comments:
Post a Comment