[DB-SIG] pygresql class field auto-generation

James Saker jsaker at americanrelay.com
Fri Jul 29 22:28:55 CEST 2005


Hello,

I've been working with pygresql succesfully through a project that has a need 
for classes to mirror my postgresql tables while operating (it's a customer 
billing project). To this point, I've manually created classes like customer, 
product, subscription all manually by mirroring the structure of the 
postgresql table in a static class definition of the same name. Then I've 
built methods to initialize the objects after testing for valid criteria 
(e.g. valid integer value customer ID of ten digits before querying the 
database and populating the customer object). The real downside is that this 
takes forever, is terribly static and rather time consuming to build and 
maintain.

Having read some of pg.DB's capabilities like get_attnames(table), and looking 
at a psycopg recipe with some similar capabilities, I was curious if anyone 
knew if a good pygresql class recipe I can inherit from that would provide 
this mechanism of getting all the attributes and automatically generating the 
object's attributes to match, along with other useful insertion/query 
methods.

Jamie


More information about the DB-SIG mailing list