From: Mike Bayer Date: Wed, 8 Jun 2022 15:56:57 +0000 (-0400) Subject: add note re: pickling for loader criteria X-Git-Tag: rel_1_4_38~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f73cc2291906d3c4102173f6020529b705f55ee;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git add note re: pickling for loader criteria Change-Id: I75992af71ba08799a03995178a6e4612c9a7428a References: #8108 --- diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py index a5c571ad75..1c9c9c796f 100644 --- a/lib/sqlalchemy/orm/util.py +++ b/lib/sqlalchemy/orm/util.py @@ -1092,12 +1092,19 @@ class LoaderCriteriaOption(CriteriaOption): accepts a target class as an argument, when the given class is a base with many different mapped subclasses. + .. note:: when the SQL expression is a lambda, **pickling is not + supported**. Set + :paramref:`_orm.with_loader_criteria.propagate_to_loaders` + to ``False`` to prevent the object from being applied to instances. + :param include_aliases: if True, apply the rule to :func:`_orm.aliased` constructs as well. :param propagate_to_loaders: defaults to True, apply to relationship - loaders such as lazy loaders. - + loaders such as lazy loaders. This indicates that the + option object itself including SQL expression is carried along with + each loaded instance. Set to ``False`` to prevent the object from + being assigned to individual instances. .. seealso::