diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-05-06 12:24:00 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-05-06 13:57:43 -0400 |
commit | 6967b4502079e199b12f5eb307d10d27ec92d537 (patch) | |
tree | 01ac7d137bee27bfd8ec9432639115327e1fe636 /test/sql/test_operators.py | |
parent | 900d76b8f757a8a42bfb8fc737d24a94eeeac05f (diff) | |
download | sqlalchemy-6967b4502079e199b12f5eb307d10d27ec92d537.tar.gz |
don't cache TypeDecorator by default
The :class:`.TypeDecorator` class will now emit a warning when used in SQL
compilation with caching unless the ``.cache_ok`` flag is set to ``True``
or ``False``. ``.cache_ok`` indicates that all the parameters passed to the
object are safe to be used as a cache key, ``False`` means they are not.
Fixes: #6436
Change-Id: Ib1bb7dc4b124e38521d615c2e2e691e4915594fb
Diffstat (limited to 'test/sql/test_operators.py')
-rw-r--r-- | test/sql/test_operators.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/sql/test_operators.py b/test/sql/test_operators.py index 8fe802bf3..932d30742 100644 --- a/test/sql/test_operators.py +++ b/test/sql/test_operators.py @@ -500,6 +500,7 @@ class TypeDecoratorComparatorTest(_CustomComparatorTests, fixtures.TestBase): def _add_override_factory(self): class MyInteger(TypeDecorator): impl = Integer + cache_ok = True class comparator_factory(TypeDecorator.Comparator): def __init__(self, expr): @@ -520,6 +521,7 @@ class TypeDecoratorTypeDecoratorComparatorTest( def _add_override_factory(self): class MyIntegerOne(TypeDecorator): impl = Integer + cache_ok = True class comparator_factory(TypeDecorator.Comparator): def __init__(self, expr): @@ -533,6 +535,7 @@ class TypeDecoratorTypeDecoratorComparatorTest( class MyIntegerTwo(TypeDecorator): impl = MyIntegerOne + cache_ok = True return MyIntegerTwo @@ -556,6 +559,7 @@ class TypeDecoratorWVariantComparatorTest( class MyInteger(TypeDecorator): impl = Integer + cache_ok = True class comparator_factory(TypeDecorator.Comparator): def __init__(self, expr): @@ -587,6 +591,7 @@ class CustomEmbeddedinTypeDecoratorTest( class MyDecInteger(TypeDecorator): impl = MyInteger + cache_ok = True return MyDecInteger |