#!/usr/bin/python
import MySQLdb
try:
conn=MySQLdb.connect(host='localhost',user='root',passwd='cdyanfa',port=3306)
cur=conn.cursor()
conn.select_db('nova')
count=cur.execute('select * from instances')
print 'there has %s rows record' % count
cur.execute('SELECT uuid,hostname FROM instances where deleted = 0')
print "Rows selected:", cur.rowcount
for row in cur.fetchall():
print "note : ", row[0], row[1]
conn.commit()
cur.close()
conn.close()
except MySQLdb.Error,e:
print "Mysql Error %d: %s" % (e.args[0], e.args[1])