]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
fix construct_params() for render_postcompile; add new API
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 8 Dec 2022 16:00:31 +0000 (11:00 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 8 Dec 2022 22:37:25 +0000 (17:37 -0500)
commit8a152ec391118a05ac54974d0f013cf0e99c7832
tree8be0d84b96e38ecb4f60f178507f8805e0b30309
parentcaccf151f2e1b357fa2a5d37135580ce9931eec2
fix construct_params() for render_postcompile; add new API

The :meth:`.SQLCompiler.construct_params` method, as well as the
:attr:`.SQLCompiler.params` accessor, will now return the
exact parameters that correspond to a compiled statement that used
the ``render_postcompile`` parameter to compile.   Previously,
the method returned a parameter structure that by itself didn't correspond
to either the original parameters or the expanded ones.

Passing a new dictionary of parameters to
:meth:`.SQLCompiler.construct_params` for a :class:`.SQLCompiler` that was
constructed with ``render_postcompile`` is now disallowed; instead, to make
a new SQL string and parameter set for an alternate set of parameters, a
new method :meth:`.SQLCompiler.construct_expanded_state` is added which
will produce a new expanded form for the given parameter set, using the
:class:`.ExpandedState` container which includes a new SQL statement
and new parameter dictionary, as well as a positional parameter tuple.

Fixes: #6114
Change-Id: I9874905bb90f86799b82b244d57369558b18fd93
doc/build/changelog/unreleased_20/6114.rst [new file with mode: 0644]
doc/build/core/internals.rst
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/testing/assertions.py
test/sql/test_compiler.py