Wow, OK great, you were able to make something work while maintaining the ClassManager approach.
So the first thing is, you can skip the redefinition of Mapper(). You can put your custom ClassManager class right on a base or mixin class like this: class MySpecialMixin(object): __sa_instrumentation_manager__ = MySpecialClassManager The next thing is, you could also instead subclass InstrumentationManager instead of ClassManager, which provides hooks that are a bit more public. I'd probably need to add some more hooks to it in order to fulfill this use case, though. If you look through instrumentation.py _ClassInstrumentationAdapter you can see what that adaption looks like. You can see examples of custom instrumentation in examples/custom_attributes/custom_management.py. This would be *really* neat if it actually works all the way using public API. This would probably go right into the examples/custom_attributes/ directory as a recipe to use for lower-latency read-only objects. On Mar 5, 2012, at 4:14 PM, Andrey Popp wrote: > Hello, > just for the record, I've built a quick and dirty hack[1] which simplifies > state-management for immutable domain models (can create but can't modify). > Achieved 2-2.5x speedup in pickle/unpickle (see tests module). I'm not just > suggesting anyone to use this in production (though I already do :-)) so this > is just FYI. > > [1]: https://github.com/andreypopp/saimmutable > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalchemy@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 sqlalchemy@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.