summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/psycopg2cffi.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-04-01 17:20:31 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2021-04-01 18:59:41 -0400
commit20c0f774e5517514da811bc446812baa6b1f32f1 (patch)
tree31130474fc5aabcd7143ac5b0ba585c25700169a /lib/sqlalchemy/dialects/postgresql/psycopg2cffi.py
parentdc5ade010da55c1158ee7294c9e882cc52cd6e01 (diff)
downloadsqlalchemy-20c0f774e5517514da811bc446812baa6b1f32f1.tar.gz
Default caching to opt-out for 3rd party dialects
Added a new flag to the :class:`_engine.Dialect` class called :attr:`_engine.Dialect.supports_statement_cache`. This flag now needs to be present directly on a dialect class in order for SQLAlchemy's :ref:`query cache <sql_caching>` to take effect for that dialect. The rationale is based on discovered issues such as :ticket:`6173` revealing that dialects which hardcode literal values from the compiled statement, often the numerical parameters used for LIMIT / OFFSET, will not be compatible with caching until these dialects are revised to use the parameters present in the statement only. For third party dialects where this flag is not applied, the SQL logging will show the message "dialect does not support caching", indicating the dialect should seek to apply this flag once they have verified that no per-statement literal values are being rendered within the compilation phase. Fixes: #6184 Change-Id: I6fd5b5d94200458d4cb0e14f2f556dbc25e27e22
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/psycopg2cffi.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/psycopg2cffi.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/psycopg2cffi.py b/lib/sqlalchemy/dialects/postgresql/psycopg2cffi.py
index a449f9e65..780244be9 100644
--- a/lib/sqlalchemy/dialects/postgresql/psycopg2cffi.py
+++ b/lib/sqlalchemy/dialects/postgresql/psycopg2cffi.py
@@ -28,6 +28,7 @@ from .psycopg2 import PGDialect_psycopg2
class PGDialect_psycopg2cffi(PGDialect_psycopg2):
driver = "psycopg2cffi"
supports_unicode_statements = True
+ supports_statement_cache = True
# psycopg2cffi's first release is 2.5.0, but reports
# __version__ as 2.4.4. Subsequent releases seem to have