On Aug 3, 2010, at 5:00 PM, Bryan wrote:

> Python 2.5.4
> MySQL python 1.2.3c1
> sqlalchemy 0.5.2

just curious can you try with SQLA 0.6.3 ?



> 
> Here is the actual code.  It references my object model etc so it
> won't run for you, but just in case I made a mistake converting it to
> a simplified version of the problem here it is:
> 
> dollars = func.if_(EmpTime.actTotal != None, EmpTime.actTotal,
>               EmpTime.estTotal, type_=types.Numeric)
> q = orm.query(
>               Account.code,
>               func.lower(TimeType.shortName),
>               func.sum(EmpTime.hours),
>               func.sum(dollars, type_=types.Numeric)
>               )
> q = q.join(EmpTime.acc).join(EmpTime.timeType)
> q = q.group_by(Account.code).group_by(TimeType.shortName)
> q = q.filter(EmpTime.day >= start)
> q = q.filter(EmpTime.day <= end)
> q = q.filter(EmpTime.jobId == jobId)
> labor = q.all()
> 
> 
> On Aug 3, 1:26 pm, Michael Bayer <mike...@zzzcomputing.com> wrote:
>> On Aug 3, 2010, at 2:56 PM, Bryan wrote:
>> 
>>> This returns a Decimal type for c2, which is what I want:
>>> c1 = literal(5, type_=Numeric)
>>> c2 = func.sum(c1, type_=Numeric)
>> 
>>> This returns a Float type for c2, but I'm telling c1 that it is a
>>> Numeric.  How can I get a decimal returned when using an if function?
>>> c1 = func.if_(Table.foo != None, Table.foo, Table.bar, type_=Numeric)
>>> c2 = func.sum(c1, type_=Numeric)
>> 
>> I see nothing wrong with that code.    Can I get some SQLA version / 
>> database backend / DBAPI details ?
>> 
>> 
>> 
>>> --
>>> 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 
>>> athttp://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.
> 

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

Reply via email to