MySQL Forums
Forum List  »  Connector/Python

Need help retrieving boolean value using MySQLdb
Posted by: daniel powell
Date: October 23, 2013 01:09PM

I have code written in python that accesses a Mysql database via the Mysqldb library. I can succesfully connect to the database and execute a query which then returns a value representing how many rows in the table matched the query requirments. What I can't seem to figure out is how to return the actuall value of the boolean feild I'm trying to access. Here is my code snippet.

import MySQLdb

db = MySQLdb.connect(host="localhost", user="pi", passwd="raspberry", db="django_website_db")
cur = db.cursor()

while (1):

update_kill = cur.execute("SELECT preprogramUpdate FROM website_preprogram WHERE preprogramNumber= 3")
rows = cur.fetchall()
for row in rows:
print row[0]

print update_kill

So to reiterate, I'm trying to return the actuall value of "preprogramUpdate" in my query.....

Thanks in advance for any help!

Options: ReplyQuote


Subject
Written By
Posted
Need help retrieving boolean value using MySQLdb
October 23, 2013 01:09PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.