]> git.ipfire.org Git - thirdparty/fastapi/sqlmodel.git/commitdiff
🐛 Fix `Select` and `SelectOfScalar` to inherit cache to avoid warning: `SAWarning...
authorRabin Adhikari <rabin.adk1@gmail.com>
Sat, 27 Aug 2022 23:17:37 +0000 (05:02 +0545)
committerGitHub <noreply@github.com>
Sat, 27 Aug 2022 23:17:37 +0000 (01:17 +0200)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
sqlmodel/sql/expression.py.jinja2

index 033130393a7da45d41d87a218314a5f84c86389c..51f04a215d29d63785b4cd0ce4785fd5f668e12e 100644 (file)
@@ -27,14 +27,14 @@ _TSelect = TypeVar("_TSelect")
 if sys.version_info.minor >= 7:
 
     class Select(_Select, Generic[_TSelect]):
-        pass
+        inherit_cache = True
 
     # This is not comparable to sqlalchemy.sql.selectable.ScalarSelect, that has a different
     # purpose. This is the same as a normal SQLAlchemy Select class where there's only one
     # entity, so the result will be converted to a scalar by default. This way writing
     # for loops on the results will feel natural.
     class SelectOfScalar(_Select, Generic[_TSelect]):
-        pass
+        inherit_cache = True
 
 else:
     from typing import GenericMeta  # type: ignore
@@ -43,10 +43,10 @@ else:
         pass
 
     class _Py36Select(_Select, Generic[_TSelect], metaclass=GenericSelectMeta):
-        pass
+        inherit_cache = True
 
     class _Py36SelectOfScalar(_Select, Generic[_TSelect], metaclass=GenericSelectMeta):
-        pass
+        inherit_cache = True
 
     # Cast them for editors to work correctly, from several tricks tried, this works
     # for both VS Code and PyCharm