MySQL Forums
Forum List  »  Connector/Python

Re: Need help retrieving boolean value using MySQLdb
Posted by: Geert Vanderkelen
Date: October 24, 2013 09:56PM

Hello Danial,

First, in MySQL, the BOOLEAN data type is a synonym for TINYINT(1). Quoting the manual:
"These types are synonyms for TINYINT(1). A value of zero is considered false. Nonzero values are considered"

If your column preprogramUpdate is of any numeric type, you might want something like this:

if rows[0]:
preprogram_update = True
else:
preprogram_update = False


Cheers,
Geert

Geert Vanderkelen
Software Developer at Oracle

Options: ReplyQuote


Subject
Written By
Posted
Re: Need help retrieving boolean value using MySQLdb
October 24, 2013 09:56PM


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.