types: Set 'cache_ok'
Resolves the following warning that has been popping up on tests: SAWarning: TypeDecorator SoftDeleteInteger() will not produce a cache key because the ``cache_ok`` flag is not set to True. Set this flag to True if this type object's state is safe to use in a cache key, or False to disable this warning. Both SoftDeleteInteger and the various subclasses of 'JsonEncodedType' are hashable and should return a consistent hash and key. For more information, refer to the SQLAlchemy docs [1]. [1] https://docs.sqlalchemy.org/en/14/core/custom_types.html#sqlalchemy.types.TypeDecorator.cache_ok Change-Id: Idf6fd858fad9521c7c5ba82c31b6d3077756abd9 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
parent
be2cc6a2ce
commit
1dc20f646b
@ -21,6 +21,8 @@ class JsonEncodedType(TypeDecorator):
|
||||
|
||||
type = None
|
||||
impl = Text
|
||||
cache_ok = True
|
||||
"""This type is safe to cache."""
|
||||
|
||||
def __init__(self, mysql_as_long=False, mysql_as_medium=False):
|
||||
"""Initialize JSON-encoding type."""
|
||||
@ -101,6 +103,8 @@ class SoftDeleteInteger(TypeDecorator):
|
||||
"""
|
||||
|
||||
impl = Integer
|
||||
cache_ok = True
|
||||
"""This type is safe to cache."""
|
||||
|
||||
def process_bind_param(self, value, dialect):
|
||||
"""Return the binding parameter."""
|
||||
|
Loading…
Reference in New Issue
Block a user