the example program you posted is against SQLite.  SQLite doesnt have  
"floats" per se, it only has "REAL", and a type "affinity" called  
NUMERIC.  See http://www.sqlite.org/datatype3.html .    So the sqlite  
dialect in SA renders NUMERIC for the "Float" type.  If you run it on  
postgres, you get:

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 FLOAT(10)) / CAST(mytable."colC" AS FLOAT(10))  
AS anon_1
FROM mytable ORDER BY mytable.id

and then a division by zero error which seems to be related to the  
specific data in use (I haven't looked closely at the data itself in  
the example).


On Jul 1, 2008, at 3:09 PM, Dominique wrote:

>
> Hi,
>
> Another way to ask the same question:
> How can I force SA to take floats into account rather than Numeric ?
>
> Even when columns are declared (in classes or through cast() ) as
> floats, SA seems to systematically convert them into Numeric, leading
> to the previous question...
>
> I tried making my own type as explained in
> http://www.sqlalchemy.org/docs/05/types.html#types_custom, but without
> success.
>
> Any help would be much appreciated.
> I would really like to improve my level in both python and SA ;-).
> Some day, I'll help newbies !
>
> Many thanks in advance
>
> Dominique
> >


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

Reply via email to