2 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: Problem with tinyint...
FromSent OnAttachments
Mike Bernson28 Aug 2007 17:27 
jason kirtland28 Aug 2007 18:14 
Subject:[sqlalchemy] Re: Problem with tinyint(1) on mysql
From:jason kirtland (je@discorporate.us)
Date:08/28/2007 06:14:21 PM
List:com.googlegroups.sqlalchemy

Mike Bernson wrote:

Using SQLAlchemy version 0.4b4. When reflecting table from mysql database with tinyint(1) you get a boolean back. I think this is error because it returns a bad data type for tinyint(1).

I have a database that work under 0.3.0 where to store a single digit I used tinyint(1) and now this breaks under 0.4.0.

As far a I known mysql version 5.x does not have a real boolean so reflecting a boolean hiding a real and valid type

Can this be switch back to tinyint ?

Sure, just override the column type on reflection:

from sqlalchemy.databases import mysql Table('mytable', metadata, Column('mydigit', mysql.MSTinyInteger), # or, just use Integer autoload=True)

Treating tinyint(1) as boolean is a general MySQL convention that SQLAlchemy honors. Note that the '1' is not a precision modifier- 'tinyint' and 'tinyint(1)' both store signed values up to 127.