diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-10-25 10:08:18 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-10-25 10:10:55 -0400 |
| commit | 172d99a8a1282b534aeadafebdd2af0162758931 (patch) | |
| tree | c46c5719ce0d97ac5fed7a9b8a6a7e6135a06b3a /lib | |
| parent | 5bfb006ae5d38f9a2ec11f9c399f3a5c4bf16d7a (diff) | |
| download | sqlalchemy-172d99a8a1282b534aeadafebdd2af0162758931.tar.gz | |
Warn that before_compile for lazyload needs bake_queries=False
The longer term future plan for ORM queries is that there
will be a new hook that receives queries before invocation
rather than "compilation", which will make use of a new
caching system.
Fixes: #4947
Change-Id: I256c16155a0cc9b7133e86e22d27040cb64eb1a9
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sqlalchemy/orm/events.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/events.py b/lib/sqlalchemy/orm/events.py index 778ad3378..5bb67b68f 100644 --- a/lib/sqlalchemy/orm/events.py +++ b/lib/sqlalchemy/orm/events.py @@ -2397,6 +2397,13 @@ class QueryEvents(event.Events): The event should normally be listened with the ``retval=True`` parameter set, so that the modified query may be returned. + .. warning:: If the :meth:`.QueryEvents.before_compile` event is to + be applied to :class:`.Query` objects that are used for lazy loading + of :func:`.relationships` (as described at :ref:`lazy_loading`), + it may be necessary to set :paramref:`.relationship.bake_queries` + to ``False``, else the :meth:`.QueryEvents.before_compile` event + will not be invoked for each lazy load operation. + .. seealso:: :meth:`.QueryEvents.before_compile_update` |
