Add caching capabilities for hybrid attributes
Issue #3678
wontfix
It's often useful to have cached properties, especially for computationally expensive properties. Werkzeug has a @cached_property
decorator that works very nicely for this, but it can't be used directly with @hybrid_property
. Could a feature be added to SQLAlchemy's hybrid attributes to allow automatic per-instance caching?
Comments (2)
-
repo owner -
repo owner - changed status to wontfix
this should likely be handled as part of 3rd party utility systems.
- Log in to comment
perhaps this is something sqlalchemy_utils or similar provides ? caching is a controversial subject so I like to keep this out of SQLAlchemy itself, there's enough features to maintain. SQLA's own recommendation is to use Dogpile Caching (also mine) which has a cache decorator.
also im not sure how caching would interact with a hybrid property at the class level.