]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Revise attribute refresh for with_loader_criteria, related
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 11 Dec 2020 15:34:44 +0000 (10:34 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 11 Dec 2020 16:46:48 +0000 (11:46 -0500)
commitc46279d1c215b7af956e40cb29afafba29d9143f
treedb93eef98b764a522dce45329b1565928ba2b903
parenta15aeba4fb22503c1eb235fdc2e7a574136ca7dc
Revise attribute refresh for with_loader_criteria, related

Added new attribute :attr:`_orm.ORMExecuteState.is_column_load` to indicate
that a :meth:`_orm.SessionEvents.do_orm_execute` handler that a particular
operation is a primary-key-directed column attribute load, such as from an
expiration or a deferred attribute, and that WHERE criteria or additional
loader options should not be added to the query.   This has been added to
the examples which illustrate the :func:`_orm.with_loader_criteria` option.

The :func:`_orm.with_loader_criteria` option has been modified so that it
will never apply its criteria to the SELECT statement for an ORM refresh
operation, such as that invoked by :meth:`_orm.Session.refresh` or whenever
an expired attribute is loaded.   These queries are only against the
primary key row of the object that is already present in memory so there
should not be additional criteria added.

Added doc caveats for using lambdas.

Added test coverage for most ORMExecuteState flags and fixed a few
basic access issues.

Change-Id: I6707e4cf0dc95cdfb8ce93e5ca22ead86074baa7
References: #5760
Fixes: #5761
Fixes: #5762
doc/build/changelog/unreleased_14/5761.rst [new file with mode: 0644]
doc/build/changelog/unreleased_14/5762.rst [new file with mode: 0644]
doc/build/orm/session_events.rst
examples/extending_query/filter_public.py
lib/sqlalchemy/orm/interfaces.py
lib/sqlalchemy/orm/session.py
lib/sqlalchemy/orm/util.py
test/orm/test_events.py
test/orm/test_relationship_criteria.py