"Dom Dom" <[EMAIL PROTECTED]> wrote in
message
news:[EMAIL PROTECTED]
>> The query, translated into sql by SQLAlchemy, is (it returns tuple
>> objects): SELECT mytable.id AS mytable_id, mytable."colA" AS
>> "mytable_colA", mytable."colB" AS "mytable_colB", mytable."colC" AS
>> "mytable_colC", CAST(mytable."colB" AS NUMERIC(10, 2)) /
>> CAST(mytable."colC" AS NUMERIC(10, 2)) AS anon_1
>> FROM mytable ORDER BY mytable.oid
>>
>> This query does not return correct results: 1/10 should be 0.1 and
>> not 0

Would it be possible to get SQLAlchemy to cast to REAL, FLOAT or DOUBLE 
rather than NUMERIC? Casting to NUMERIC leaves integers as integers; 
basically, it's a no-op in your query. For more details, see 
http://www.sqlite.org/datatype3.html
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925 



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to