SQLAlchemy has hybrid attributes, which you could use to build any sort of system:
from sqlalchemy.ext.hybrid import hybrid_property
class Article(Base):
@hybrid_property
def published(self):
return self.is_published == True
@hybrid_property
def recent(self):
# this relies on the date arithmetic of the target backend
return datetime.now() - self.created_at >= datetime.timedelta(days=7)
articles = query(Article).filter(Article.published, Article.recent).all()