Ability to plug-in/override Decimal Handler ?

Stef Telford <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
Hey Everyone,
    I haven't ever had much recourse to email the mailing list, as I am 
mostly one of those ORM folks that uses the upper layer. Apologies in 
advance for that ;) However, I have noticed that during bulk operations 
(mostly instantiations) using the ORM that the decimal.Decimal is slow. 
I mean 400seconds slow, when compared to using gmpy.mpq which ends up 
running in 50seconds.

    So, is it possible to overload the pscyopg2 adapter to use gmpy ? 
Currently, I have changed the psycopgmodule to
   
    decimal = PyImport_ImportModule("gmpy");
   
    and

    decimalType = PyObject_GetAttrString(decimal, "mpq");
   
    Which works great, however, I really don't want to fork an entire 
library over a two line change. So. Any ideas/thoughts on how I would 
inform psycopg2 to use gmpy.mpq instead for Decimals in a 'nicer' fashion ?

   
    I am sure there is probably something obvious I am missing :D
    Regards  
    Stef Telford
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.