i personally wouldn' do that, because my SqlAlchemy classes are really just used for populating a read-only cache -- which is a dict -- and creating/editing records.
in your case... and I'm just thinking out loud... 1. you could create an abstract class called CacheBacked, which your Reflected/Declared tables would also intherit from. you could then provide a "get_by_id(id)" function. Calling that could try to load from a cache, and then failover to loading form SqlAlchemy. there are a lot of problems with that approach though, as SqlAlchemy and your transaction layer may try to persist the objects. the interface would be really awkward too. 2. you could create a wrapper class that proxies a bunch of sqlalchemy objects and saves them to a cache.. class CacheBacked(object): wrapped_sqla_class= None data_structure= None def load(id): self.data_structure= load_from_memory() if not data_structure: wrapped_instance= dbSession.query( self.wrapped_sqla_class ).filter_by(id=id).one() self.data_structure= pull_details_of( wrapped_instance ) class Useraccount(): wrapped_sqla_class= models.Useraccount although, honestly, i don't like either of those ideas and wouldn't do them. hopefully someone here has a good idea ( i just felt it worthwhile to discuss bad ideas! ) -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.