On Nov 17, 2010, at 4:23 AM, J wrote: > so i'm using sqlsoup to support a legacy db, and am thoroughly > enjoying it. it was awesome setting up relationships and all that > even though the underlying db schema didn't have any foreign key > defines! > > however, i'm at a point where i'd like to add some helper funcitons/ > methods to some MappedFoo objects that sqlsoup likes to return. > > i was thinking of using a mixin to add the extra functionality. for > example: > > # assume foo is a MappedFoo instance returned from sqlsoup already > class x: > def bar(): print 'bar' > foo.__bases__ += (x,) > foo.bar() # prints 'bar' as expected > > however, it would be super if there was some way to have the sqlsoup > getters already have this mixin or some overriding baseclass > configured... or some automated way of applying a mixin behind the > scenes.
SqlSoup allows a "base" argument which will serve as the base class for all generated classes: SqlSoup(engine, base=MyClass) we should probably add the constructor and stuff to the docstrings. > > thoughs? thanks. > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalch...@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.