[sqlalchemy] Re: ORM base class for 0.5?

2009-01-15 Thread Bobby Impollonia
The declarative extension (sqlalchemy.ext.declarative) provides a __init__ that takes keyword args for attributes (at least it does in 0.4). On Tue, Jan 13, 2009 at 4:02 AM, Christoph Haas em...@christoph-haas.de wrote: Thanks for the code. For those who might also be interested in an ORM base

[sqlalchemy] Re: ORM base class for 0.5?

2009-01-13 Thread Christoph Haas
Thanks for the code. For those who might also be interested in an ORM base class providing __init__, update and __repr__ - this is what I use now with 0.5 (comments welcome): = import sqlalchemy as sql from sqlalchemy import orm class

[sqlalchemy] Re: ORM base class for 0.5?

2009-01-12 Thread az
def __init__( me, **ka): for k,v in ka.iteritems(): setattr( me,k,v) def update( me, ka): for k,v in ka.iteritems(): setattr( me,k,v) generic repr/str is more tricky... one way is like: for p in object_mapper(self).iterate_properties: print getattr( self, p.key) or was