SQLAlchemy ``cache_ok`` bit
See original GitHub issueWhile working with an RDS database, I received this warning, and the performance has deteriorated, from the local version, drastically:
.....lib/python3.8/site-packages/ax/storage/sqa_store/load.py:229: SAWarning: TypeDecorator JSONEncodedText() will not produce a cache key because the ``cache_ok`` attribute is not set to True. This can have significant performance implications including some performance degradations in comparison to prior SQLAlchemy versions. Set this attribute to True if this type object's state is safe to use in a cache key, or False to disable this warning. (Background on this error at: https://sqlalche.me/e/14/cprf)
Any idea on how I can address it?
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Performance - SQLAlchemy 1.4 Documentation
SQLAlchemy as of version 1.4 includes a SQL compilation caching facility which will allow Core and ORM SQL constructs to cache their stringified...
Read more >how can I stop the [UtcDateTime cache_ok ]warn? When I run ...
This is due to change in SQLAlchemy 1.4 (see release notes). If you get this warning it means that you did not install...
Read more >Do you really need Redis? How to get away with just ...
I've personally done a fair bit of migration from formal queue systems into an RDBMS. You simply get a ... If it's “just...
Read more >How to use st.cache with sqlalchemy.orm objects - Streamlit
I am writing an app for data exploration. The app uses sqlalchemy to query data from a database. Some of the queries can...
Read more >How Should I Set Up Aiomysq Pool Cache - ADocLib
In the use of sqlalchemy when , Need to use aiomysql.sa.createengine Function ... A new class-level attribute TypeDecorator.cacheok may be set which will...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
😬 Okay, this seems like a bit of a pain for you. I do see a problem in that the dict passed to
JSONEncodedText
is not hashable, but I’m also seeing it hashes the arguments to__init__()
, notprocess_bind_param()
which I’m confused about, so I’m running some tests to see if anything breaks.Unfortunately it happens in 0.2.5.1 too, but on line 232 now
/storage/sqa_store/load.py:232: SAWarning: TypeDecorator JSONEncodedText() will not produce a cache key because the ``cache_ok`` attribute is not set to True. This can have significant performance implications including some performance degradations in comparison to prior SQLAlchemy versions. Set this attribute to True if this type object's state is safe to use in a cache key, or False to disable this warning. (Background on this error at: https://sqlalche.me/e/14/cprf) .one_or_none()
SQLAlchemy==1.4.39 python ==3.10.5Apparently the cache_ok = True line in JSONEncodedObject doesn’t cut it.