zende wrote: > I wrote a simple layer on top of my models that allows them to be > easily inserted into and fetched from memcache. Now, I'm trying to > solve the easier part :) -- cache invalidation. I can use mapper > extensions, but I'm looking for a cleaner way. The biggest problem > with MapperExtension is that some of the models already have mapper > extensions, and in general, it's rather klunky to integrate mapper > extensions into every single model we have in our code base. > > Is there a way that I can have mapper extension like functionality, > except putting it on a base class and is inherited from all the > models? If not, any recommendations on how to add mapper extensions > across many model in a large code base?
SessionExtension might be more appropriate for "model-on-change" events. Also, to add a MapperExtension to every mapper, build yourself a mapper() function that wraps SQLA's mapper() function. If you're on declarative then send that function in to declarative_base. > > Thanks! > > -- > > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
