From: Mike Bayer Date: Thu, 17 Dec 2020 15:14:18 +0000 (-0500) Subject: lambda refactor post-production fixes X-Git-Tag: rel_1_4_0b2~94 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=78229dbe10931b4155f21308bd24fb3768a7b672;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git lambda refactor post-production fixes comments from 77c9534dcaf3723f7b2baf42442eda3e1d8c3332 addressed Change-Id: I09ae6429ecc89f6fd0949d7d5f1fb4d977e91ad4 --- diff --git a/doc/build/core/connections.rst b/doc/build/core/connections.rst index 629bec333a..1bb784068d 100644 --- a/doc/build/core/connections.rst +++ b/doc/build/core/connections.rst @@ -1316,7 +1316,7 @@ Basic guidelines include: creates a cache key from other closure variables within the statement. In order to provide the best guarantee of an accurate cache key, all objects located in the closure of the lambda are considered to be significant, and none - will none will be assumed to be appropriate for a cache key by default. + will be assumed to be appropriate for a cache key by default. So the following example will also raise a rather detailed error message:: >>> class Foo: diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py index 88f9a34d05..bbb428683e 100644 --- a/lib/sqlalchemy/orm/util.py +++ b/lib/sqlalchemy/orm/util.py @@ -995,7 +995,7 @@ class LoaderCriteriaOption(CriteriaOption): :meth:`_orm.SessionEvents.do_orm_execute` event. :param track_closure_variables: when False, closure variables inside - of a lambda expression will not be validated used as part of + of a lambda expression will not be used as part of any cache key. This allows more complex expressions to be used inside of a lambda expression but requires that the lambda ensures it returns the identical SQL every time given a particular class. diff --git a/test/orm/test_selectin_relations.py b/test/orm/test_selectin_relations.py index 4b486f8717..de6282da57 100644 --- a/test/orm/test_selectin_relations.py +++ b/test/orm/test_selectin_relations.py @@ -722,7 +722,6 @@ class EagerTest(_fixtures.FixtureTest, testing.AssertsCompiledSQL): ) self.assert_sql_count(testing.db, go, count) - return eq_( sess.query(User)