From: Ian B. <ia...@co...> - 2004-12-06 16:19:18
|
Carlos Ribeiro wrote: > I just downloaded & installed the decimal module (the same from Python > 2.4) for Python 2.3. I know that SQLObject has a DecimalCol type. I've > tried to check the code that actually fetches decimal values from the > DB, but I got a little bit lost on SQLObject internals at this point. > I trie to grep for Decimal and found only a few references, so I > assume it's not full implemented yet. One way would be to handle the conversion through the driver. This should be doable with psycopg. Some way you have to get the value from the database, probably as a string, then convert it to decimal. Obviously it's not very helpful if you get it from the database as a float, then convert it to a decimal. Right now there's no good hooks for coercing something before it is returned. E.g., in Postgres I think that'd be something like "SELECT (CAST dec_column AS TEXT) AS dec_column", which would keep psycopg from converting to a float. -- Ian Bicking / ia...@co... / http://blog.ianbicking.org |