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

Diedrich Vorberg orm-devel@mailman.tux4web.de
Sat, 7 Dec 2002 05:41:24 +0100

Good evening Eric!
Hi Ross, Julio and Mike! You guys still up?
A good afternoon Uwe!
And to those Europeans who got an early start or didn't bother to go 
sleep: a very good morning to you!

It's 5 A.M. now and I think it was worth it ;-)

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


    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 :-)

Check out the new version from CVS and, if time permits, do some 

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 ;-)

           _..._                            Diedrich Vorberg
         .'     '.
        /  _   _  \                         http://www.tux4web.de
        | (o)_(o) |                         info@tux4web.de
         \(     ) /            .---.
         //'._.'\ \           /     \       Internet Dienstleistungen
        //   .   \ \          \.@-@./       und 'Consulting'.
       ||   .     \ \         /`\_/`\
       |\   :     / |        //  _  \\      Linux Rules!
       \ `) '   (`  /_      | \     )|_
     _)``".____,.'"` (_    /`\_`>  <_/ \
     )     )'--'(     (    \__/'---'\__/
      '---`      `---`