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.