Re: [sqlalchemy] TypeError: unsupported operand type(s) for -: 'float' and 'datetime.datetime' when subtracting DateTime columns directly with MySQL database

2013-06-29 Thread Charlie Clark
Am 28.06.2013, 22:45 Uhr, schrieb Michael Bayer : its a missing feature right now. ideally we can add a rule to MySQL's datetime object that subtraction should return a type that will translate the float to an Interval (I'm guessing it's a number of days). FWIW the MySQL function timediff

Re: [sqlalchemy] TypeError: unsupported operand type(s) for -: 'float' and 'datetime.datetime' when subtracting DateTime columns directly with MySQL database

2013-06-29 Thread Łukasz Fidosz
Thanks:) I previously used cast instead of types_coerce for my use case. On Friday, June 28, 2013 10:45:35 PM UTC+2, Michael Bayer wrote: > > > On Jun 28, 2013, at 4:20 PM, Łukasz Fidosz > > wrote: > > > Hi, > > When subtracting DateTime columns in query, like: > session.query((Foo.datetime1 -

Re: [sqlalchemy] TypeError: unsupported operand type(s) for -: 'float' and 'datetime.datetime' when subtracting DateTime columns directly with MySQL database

2013-06-28 Thread Michael Bayer
On Jun 28, 2013, at 4:20 PM, Łukasz Fidosz wrote: > Hi, > When subtracting DateTime columns in query, like: > session.query((Foo.datetime1 - Foo.datetime2).label('diff')) SQLAlchemy tries > to handle result as timedelta but MySQL returns float as a result so it > crashes with "TypeError: unsu

[sqlalchemy] TypeError: unsupported operand type(s) for -: 'float' and 'datetime.datetime' when subtracting DateTime columns directly with MySQL database

2013-06-28 Thread Łukasz Fidosz
Hi, When subtracting DateTime columns in query, like: session.query((Foo.datetime1 - Foo.datetime2).label('diff')) SQLAlchemy tries to handle result as timedelta but MySQL returns float as a result so it crashes with "TypeError: unsupported operand type(s) for -: 'float' and 'datetime.datetime'