So I have this following code: class User(Base): ....
class AgeComparator(PropComparator): def __lt__(self, other): pass def __gt__(self, other): pass def __eq__(self, other): pass def __ne__(self, other): return not (self == other) def __le__(self, other): return self < other or self == other def __ge__(self, other): return self > other or self == other @comparable_using(AgeComparator) @property def age(self): today = date.today() age = today - (self.date_of_birth or (today + 1)) return age.days / 365 All I want to do is this: user = User(date_of_birth=date.today()) session.add(user) new_borns = session.query(User).filter(User.age == 0).all() The doc for comparable_property() suggests that this is possible, but I'm lost finding my way to call the descriptor bound on this instance. The problem I have is that the ComparableProperty only gave itself and the mapper to the comparator, but the user instance is nowhere to be found inside either ComparableProperty, PropComparator or mapper. I'd appreciate some help here if this is at all possible. The documents on this is a little too sparse IMO. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---