[sqlalchemy] integer fields return long python type on query

2010-02-10 Thread Simone Orsi
Hi all,

I have a lot of integer fields in a mysql db and when I query them I get
always a long python type instead of an integer python type.

Is quite annoying to convert long to int every time... how can I get rid
of this?

I remember that with mysql-python you can pass an instance of
MySQLdb.converters to the cursor to automatically do that. Is there a
wrapper for this?

TIA,
Simone

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] integer fields return long python type on query

2010-02-10 Thread Michael Bayer

On Feb 10, 2010, at 5:12 AM, Simone Orsi wrote:

 Hi all,
 
 I have a lot of integer fields in a mysql db and when I query them I get
 always a long python type instead of an integer python type.
 
 Is quite annoying to convert long to int every time... how can I get rid
 of this?
 
 I remember that with mysql-python you can pass an instance of
 MySQLdb.converters to the cursor to automatically do that. Is there a
 wrapper for this?

you should use a TypeDecorator around Integer to process that.I didn't know 
there was a noticeable incompatibility between int and long - its a MySQLdb 
behavior and nobody has ever complained about it before.


 
 TIA,
 Simone
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To post to this group, send email to sqlalch...@googlegroups.com.
 To unsubscribe from this group, send email to 
 sqlalchemy+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/sqlalchemy?hl=en.
 

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.