On May 25, 2011, at 2:15 PM, bill curtis wrote: > Excellent, this seems to be working! > > It looks like the AppenderMixin defines it's own version of __iter__() and > count(). > > My CachingQuery does this as well. I have versions of those two functions > that check/set the cache, forwarding to the Query versions to hit the db if > necessary. > > So what I'm doing at the moment with my CachingQuery + AppenderMixin is > patching the resulting type, after the mixin happens, with versions that > check/set the cache and call the mixin versions if necessary. > > Does that sound like a sane approach to you? Or would you recommend > something different?
well there's something more intricate happening there, which is that the __iter__() on the AppenderQuery does something, but the actual "load stuff from the database" part is then called from plain Query.__iter__ - AppenderQuery's "generative" nature returns a non-AppenderQuery object. So on your end, you shouldn't need to do anything - your __iter__() will be used directly when data is actually loaded, on an object that is an instance of your Query class. Same kind of thing happens for count(). -- 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.
