Thanks for your answer. I did the exact same raw sql query (got the query string via echo=True) and it seems like mysql returned an integer (console print looked like a integer). So I concluded it has to be converted somewhere on the way through sqlalchemy.
On Tuesday, November 11, 2014 6:25:44 PM UTC+1, Thomas Wanschik wrote: > > Hi, > the query > > session.query(func.sum(MyModel.amount)).scalar() > > with > > MyModel.amount = Column(SmallInteger, nullable=False) > > returns a Decimal instead of an integer when using mysql with the default > driver (as well as with the cymysql driver). > > How can I get this query to return an integer? And why can't it return an > integer automatically? > > Thanks in advance > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.