diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-04-01 17:20:31 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-04-01 18:59:41 -0400 |
commit | 20c0f774e5517514da811bc446812baa6b1f32f1 (patch) | |
tree | 31130474fc5aabcd7143ac5b0ba585c25700169a /lib/sqlalchemy/dialects/mysql/oursql.py | |
parent | dc5ade010da55c1158ee7294c9e882cc52cd6e01 (diff) | |
download | sqlalchemy-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/mysql/oursql.py')
-rw-r--r-- | lib/sqlalchemy/dialects/mysql/oursql.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/oursql.py b/lib/sqlalchemy/dialects/mysql/oursql.py index 5c8c7b7c2..06a6115b4 100644 --- a/lib/sqlalchemy/dialects/mysql/oursql.py +++ b/lib/sqlalchemy/dialects/mysql/oursql.py @@ -55,6 +55,7 @@ class MySQLExecutionContext_oursql(MySQLExecutionContext): class MySQLDialect_oursql(MySQLDialect): driver = "oursql" + supports_statement_cache = True if util.py2k: supports_unicode_binds = True |