summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Kajinami <tkajinam@redhat.com>2022-06-15 10:31:53 +0900
committerTakashi Kajinami <tkajinam@redhat.com>2022-06-15 10:35:35 +0900
commit14d2d859ef4eb3d21bf6e419a77c2f3185d5cf77 (patch)
tree3f63bcf3ace9244472e707f5a7802d8c74643caa
parent27f7a816507e94174556381297023c2039ae6594 (diff)
downloadheat-14d2d859ef4eb3d21bf6e419a77c2f3185d5cf77.tar.gz
Set cache_ok to avoid SAWarning
Since sqlalchemy 1.4.14[1], the following warning is raised unless the cache_ok flag is explicitly set in classes inheriting TypeDecorator. SAWarning: TypeDecorator Json() 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) Because the flag was set to True by default in older releases, this adds explicit cache_ok = True, to restore the previous behavior in Wallaby and older. (wallaby u-c has SQLAlchemy===1.3.23 while xena u-c has SQLAlchemy===1.4.23) [1] https://github.com/zzzeek/sqlalchemy/commit/6967b4502079e199b12f5eb307d10d27ec92d537 Change-Id: I6b84a626994543468f49373a554de44025576a9a
-rw-r--r--heat/db/sqlalchemy/types.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/heat/db/sqlalchemy/types.py b/heat/db/sqlalchemy/types.py
index 39766b893..4d4a213e5 100644
--- a/heat/db/sqlalchemy/types.py
+++ b/heat/db/sqlalchemy/types.py
@@ -23,6 +23,7 @@ loads = jsonutils.loads
class LongText(types.TypeDecorator):
impl = types.Text
+ cache_ok = True
def load_dialect_impl(self, dialect):
if dialect.name == 'mysql':
@@ -45,6 +46,7 @@ class Json(LongText):
class List(types.TypeDecorator):
impl = types.Text
+ cache_ok = True
def load_dialect_impl(self, dialect):
if dialect.name == 'mysql':