[orm-devel] The NUMERIC problem float-ing around (no more!)

Eric Walstad orm-devel@mailman.tux4web.de
Fri, 06 Dec 2002 22:27:16 -0800

Diedrich Vorberg wrote:
> Good evening Eric!
Good Morning!  Wow, an all-nighter!  You-da-man!  :)
(My 3yr old daughter won't let me do all-nighter's any more)

> This is how it works:
>   o PostgreSQL returns its results SQL literals contained in strings
>   o psycopg parses these strings and makes them Python objects
>   o to do so it employs a well designed and very pythonesqe (same 
>     thing really) mechanism 
>   o the conversion of NUMERIC(sql) to float(py) is just a default and
>     can be changed
>   o I modified the pgsql.datasource so that it does just that. Now
>     pgsql will return strings(py) for each SQL datatype that enherits 
>     from orm.adapters.pgsql.column.customType
>   o orm's convert()/format() mechanism takes care of converting these
>     strings to the right Python objects now
>   o I've created a numeric datatype and a numericColumn. They use the
>     FixedPoint module you can find at
>        http://fixedpoint.sourceforge.net/html/lib/module-FixedPoint.html
>     This lets you use arbitrary precision/exact math just like pgsql 
>     does internally.
> The best thing about it: I didn't have to mess up the code :-)
Hey, that sounds like a nice solution.  If I understand you correctly, I 
can choose to use the new numeric/Column type (and install and use 
FixedPoint) or I can choose to use customType and handle any needed 
conversions myself?  I don't care to use FixedPoint ( I don't know 
anything about it, and I may change my mind later, but for now I crave 
simplicity ).  Is FixedPoint now a requirement of orm?

> Check out the new version from CVS and, if time permits, do some 
> testing!
I will, and I'll report back what I find.  Probably by next Tuesday.

> As you can plainly see, I'm having a great time working with you and 
> I really dig this Free Software thing now. I liked the idea before, 
> but now I dig it ;-)
I second that!  I whetted my OSS appetite on ecoaccess.org (appears to 
be down now?) which is where I worked on my 
not-quite-as-fancy-pants-as-orm classes for a Task Management system. 
That was my first stab at working on a distributed OSS team and I really 
enjoyed it and learned a *lot*.  I hope I can help out with orm as it's 
already helping me.  I wish I could earn at least a meager living doing 
it - nothing is as nice as loving your work...  Well, ok, there are a 
few things nicer  ;^)

Best regards,