diff options
author | Stephen Finucane <stephenfin@redhat.com> | 2022-09-08 10:45:05 +0100 |
---|---|---|
committer | Stephen Finucane <stephenfin@redhat.com> | 2022-09-08 10:47:41 +0100 |
commit | 10e8e77a92455fb638dcc7e73c044cd22acd84ad (patch) | |
tree | 944ef44aa8bc1b7c2c899f8d67543c5eae66305c /oslo_db | |
parent | 7f3647bf9743ddfb47abc5981fc97653d5ecf09c (diff) | |
download | oslo-db-10e8e77a92455fb638dcc7e73c044cd22acd84ad.tar.gz |
types: Set 'cache_ok' (redux)
In change Idf6fd858fad9521c7c5ba82c31b6d3077756abd9, we defined the
'cache_ok' key on a number of custom types. However, we relied on this
attribute being inheritable which is not the case due to how that
attribute is checked for [1]. As a result, we must set this attribute on
every one of our custom types.
[1] https://github.com/sqlalchemy/sqlalchemy/blob/rel_1_4_41/lib/sqlalchemy/sql/type_api.py#L984
Change-Id: I005af8c7afe3b5104068ca153aecbfe54e163ca3
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Diffstat (limited to 'oslo_db')
-rw-r--r-- | oslo_db/sqlalchemy/types.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/oslo_db/sqlalchemy/types.py b/oslo_db/sqlalchemy/types.py index a86f5ac..fe40bbd 100644 --- a/oslo_db/sqlalchemy/types.py +++ b/oslo_db/sqlalchemy/types.py @@ -69,6 +69,8 @@ class JsonEncodedDict(JsonEncodedType): """ type = dict + cache_ok = True + """This type is safe to cache.""" class JsonEncodedList(JsonEncodedType): @@ -81,6 +83,8 @@ class JsonEncodedList(JsonEncodedType): """ type = list + cache_ok = True + """This type is safe to cache.""" class SoftDeleteInteger(TypeDecorator): @@ -120,9 +124,11 @@ class String(_String): mysql_ndb_type is used to override the String with another data type. mysql_ndb_size is used to adjust the length of the String. - """ + cache_ok = True + """This type is safe to cache.""" + def __init__( self, length, mysql_ndb_length=None, mysql_ndb_type=None, **kw): """Initialize options.""" |