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
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 -
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
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'