Caching column_property in sqlalchemy model via dogpile

307 views Asked by At

I wonder if there is a chance to cache column_property using dogpile.

This is my code:

A.some_count = column_property(
  select([func.count()])
    .where(and_(B.__table__.c.a_id == A.__table__.c.id,
                B.__table__.c.c_id == C.__table__.c.id))  
    .correlate(A.__table__, C.__table__)
    .as_scalar()
    .label('some_count'),
  deferred=True)

Do anybody know how to do that? Any kind of caching would be good either with time stamp or invalidate.

Thank you for help.

0

There are 0 answers