]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Improve params implementation
authorFederico Caselli <cfederico87@gmail.com>
Thu, 16 Oct 2025 18:59:30 +0000 (20:59 +0200)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 10 Nov 2025 21:50:54 +0000 (16:50 -0500)
commit33264146aef33e8f564ec2b8fc3730d59889bf18
tree66b0024aed3df89843a8ae23df85e2ff20db0dc2
parentf3fda75e3dbaf1a696f6747e113acf9e239f51ba
Improve params implementation

Added new implementation for the :meth:`.Select.params` method and that of
similar statements, via a new statement-only
:meth:`.ExecutableStatement.params` method which works more efficiently and
correctly than the previous implementations available from
:class:`.ClauseElement`, by assocating the given parameter dictionary with
the statement overall rather than cloning the statement and rewriting its
bound parameters.  The :meth:`_sql.ClauseElement.params` and
:meth:`_sql.ClauseElement.unique_params` methods, when called on an object
that does not implement :class:`.ExecutableStatement`, will continue to
work the old way of cloning the object, and will emit a deprecation
warning.    This issue both resolves the architectural / performance
concerns of :ticket:`7066` and also provides correct ORM compatibility for
functions like :func:`_orm.aliased`, reported by :ticket:`12915`.

Fixes: #7066
Change-Id: I6543c7d0f4da3232b3641fb172c24c446f02f52a
26 files changed:
doc/build/changelog/migration_21.rst
doc/build/changelog/unreleased_21/7066.rst [new file with mode: 0644]
doc/build/core/selectable.rst
lib/sqlalchemy/engine/base.py
lib/sqlalchemy/engine/default.py
lib/sqlalchemy/orm/context.py
lib/sqlalchemy/sql/__init__.py
lib/sqlalchemy/sql/_util_cy.py
lib/sqlalchemy/sql/base.py
lib/sqlalchemy/sql/cache_key.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/ddl.py
lib/sqlalchemy/sql/dml.py
lib/sqlalchemy/sql/elements.py
lib/sqlalchemy/sql/expression.py
lib/sqlalchemy/sql/functions.py
lib/sqlalchemy/sql/lambdas.py
lib/sqlalchemy/sql/selectable.py
lib/sqlalchemy/sql/traversals.py
lib/sqlalchemy/sql/visitors.py
test/orm/test_core_compilation.py
test/sql/test_compare.py
test/sql/test_external_traversal.py
test/sql/test_functions.py
test/sql/test_selectable.py
test/sql/test_statement_params.py [new file with mode: 0644]