summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2021-12-07 15:46:54 +0000
committerGerrit Code Review <gerrit@ci3.zzzcomputing.com>2021-12-07 15:46:54 +0000
commitca186ff935718e3e57bf9ecbf2619cd6109996d0 (patch)
tree568cc3ed1315feb68af2c78344a5edef89014e64 /lib/sqlalchemy/engine
parent1411f0bc4898737e3a575933e30c85a84b0bfb02 (diff)
parent22deafe15289d2be55682e1632016004b02b62c0 (diff)
downloadsqlalchemy-ca186ff935718e3e57bf9ecbf2619cd6109996d0.tar.gz
Merge "Warn when caching is disabled / document" into main
Diffstat (limited to 'lib/sqlalchemy/engine')
-rw-r--r--lib/sqlalchemy/engine/default.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py
index 9574e9980..e91e34f00 100644
--- a/lib/sqlalchemy/engine/default.py
+++ b/lib/sqlalchemy/engine/default.py
@@ -321,10 +321,23 @@ class DefaultDialect(interfaces.Dialect):
@util.memoized_property
def _supports_statement_cache(self):
- return (
- self.__class__.__dict__.get("supports_statement_cache", False)
- is True
- )
+ ssc = self.__class__.__dict__.get("supports_statement_cache", None)
+ if ssc is None:
+ util.warn(
+ "Dialect %s:%s will not make use of SQL compilation caching "
+ "as it does not set the 'supports_statement_cache' attribute "
+ "to ``True``. This can have "
+ "significant performance implications including some "
+ "performance degradations in comparison to prior SQLAlchemy "
+ "versions. Dialect maintainers should seek to set this "
+ "attribute to True after appropriate development and testing "
+ "for SQLAlchemy 1.4 caching support. Alternatively, this "
+ "attribute may be set to False which will disable this "
+ "warning." % (self.name, self.driver),
+ code="cprf",
+ )
+
+ return bool(ssc)
@util.memoized_property
def _type_memos(self):