[orm-devel] Re: ORM

Uwe (Peter) Feldtmann orm-devel@mailman.tux4web.de
07 Dec 2002 16:21:45 +0000


Hi all,

> >	Can orm be used to create the tables based on the column defs?
> No. Mike Watkins sent a program in that goes the other way 'round and
> creates orm's class definitions from the SQL layout. Check the 
> contrib/ directory.
> 

Had a quick look. Does anyone know why psycopg doesn't import column
types in cursor.description? I'll ask them on their list as well.

I haven't tested this, as I don't have pyPgSQL, but if the following
lines are modified it would be easier to spot what requires attention
for relationships in the generated code.

snip..

  if colname.find('_id') > 0:

    colclass = "relates_to(%s)" % colname.split('_')[0] 

snip..

The above should result in "category_id": relates_to(category)

If only we could find a notation for the various relationships that
wouldn't clutter up the defs.

Uwe.