[DB-SIG] pygresql class field auto-generation
Andy Todd
andy47 at halfcooked.com
Mon Aug 15 15:56:23 CEST 2005
James Saker wrote:
> 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
> _______________________________________________
> DB-SIG maillist - DB-SIG at python.org
> http://mail.python.org/mailman/listinfo/db-sig
Jamie,
I don't know if this response is too late, but have you looked at
SQLObject? [1]
It provides a ready made object-relational mapper which saves you
writing a lot of wrapper code and may be just what you are looking for.
[1] http://www.sqlobject.org/
Regards,
Andy
--
--------------------------------------------------------------------------------
From the desk of Andrew J Todd esq - http://www.halfcooked.com/
More information about the DB-SIG
mailing list