On 26 май, 20:50, "Michael Bayer" <mike...@zzzcomputing.com> wrote: > However, its quite easy to achieve. Just use this. > > class LimitingQuery(Query): > def get(self, ident): > return Query.get(self.populate_existing(), ident) > > def __iter__(self): > return Query.__iter__(self.private()) > > @_generative() > def private(self): > crit = (self._entities[0].mapper.class_.public == True) > if self._criterion: > self._criterion &= crit > else: > self._criterion = crit > > full test case attached.
Thanks a lot! But the test doesn't cover all use-cases. Here is one that fails: count1 = sess.query(Address).count() count2 = len(sess.query(Address).all()) assert count1==count2, '%d!=%d' % (count1, count2) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---