Quantcast
Channel: MySQL Forums - Connector/Python
Viewing all articles
Browse latest Browse all 384

Need help retrieving boolean value using MySQLdb (1 reply)

$
0
0
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!

Viewing all articles
Browse latest Browse all 384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>