summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/asyncpg.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/asyncpg.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/asyncpg.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/asyncpg.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/asyncpg.py b/lib/sqlalchemy/dialects/postgresql/asyncpg.py
index 4580421f6..8cd5bee41 100644
--- a/lib/sqlalchemy/dialects/postgresql/asyncpg.py
+++ b/lib/sqlalchemy/dialects/postgresql/asyncpg.py
@@ -850,6 +850,7 @@ _pg_types = {
class PGDialect_asyncpg(PGDialect):
driver = "asyncpg"
+ supports_statement_cache = True
supports_unicode_statements = True
supports_server_side_cursors = True