]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Warn when caching is disabled / document
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 3 Dec 2021 19:04:05 +0000 (14:04 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 6 Dec 2021 23:27:19 +0000 (18:27 -0500)
commit22deafe15289d2be55682e1632016004b02b62c0
tree5b521531418aebd4e293f848ebe4accbbd9bc5bc
parente88dc004e6bcd1418cb8eb811d0aa580c2a44b8f
Warn when caching is disabled / document

This patch adds new warnings for all elements that
don't indicate their caching behavior, including user-defined
ClauseElement subclasses and third party dialects.
it additionally adds new documentation to discuss an apparent
performance degradation in 1.4 when caching is disabled as a
result in the significant expense incurred by ORM
lazy loaders, which in 1.3 used BakedQuery so were actually
cached.

As a result of adding the warnings, a fair degree of
lesser used SQL expression objects identified that they did not
define caching behavior so would have been producing
``[no key]``, including PostgreSQL constructs ``hstore``
and ``array``.  These have been amended to use inherit
cache where appropriate.  "on conflict" constructs in
PostgreSQL, MySQL, SQLite still explicitly don't generate
a cache key at this time.

The change also adds a test for all constructs via
assert_compile() to assert they will not generate cache
warnings.

Fixes: #7394
Change-Id: I85958affbb99bfad0f5efa21bc8f2a95e7e46981
45 files changed:
doc/build/changelog/unreleased_14/7394.rst [new file with mode: 0644]
doc/build/core/connections.rst
doc/build/core/expression_api.rst
doc/build/core/foundation.rst [new file with mode: 0644]
doc/build/core/sqlelement.rst
doc/build/core/visitors.rst
doc/build/errors.rst
doc/build/faq/performance.rst
examples/dogpile_caching/caching_query.py
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/dialects/mysql/dml.py
lib/sqlalchemy/dialects/postgresql/array.py
lib/sqlalchemy/dialects/postgresql/dml.py
lib/sqlalchemy/dialects/postgresql/ext.py
lib/sqlalchemy/dialects/postgresql/hstore.py
lib/sqlalchemy/dialects/sqlite/dml.py
lib/sqlalchemy/engine/default.py
lib/sqlalchemy/ext/compiler.py
lib/sqlalchemy/orm/attributes.py
lib/sqlalchemy/orm/interfaces.py
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/sql/base.py
lib/sqlalchemy/sql/coercions.py
lib/sqlalchemy/sql/ddl.py
lib/sqlalchemy/sql/elements.py
lib/sqlalchemy/sql/functions.py
lib/sqlalchemy/sql/roles.py
lib/sqlalchemy/sql/traversals.py
lib/sqlalchemy/sql/type_api.py
lib/sqlalchemy/testing/assertions.py
test/dialect/mssql/test_compiler.py
test/engine/test_execute.py
test/ext/test_baked.py
test/ext/test_compiler.py
test/orm/inheritance/test_assorted_poly.py
test/orm/test_cache_key.py
test/orm/test_lambdas.py
test/orm/test_query.py
test/sql/test_compare.py
test/sql/test_functions.py
test/sql/test_labels.py
test/sql/test_lambdas.py
test/sql/test_operators.py
test/sql/test_resultset.py
test/sql/test_types.py