summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-09-02 14:47:03 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2020-09-02 14:56:49 -0400
commitb050169600019ef249a8b315e7435c752623c900 (patch)
tree32a8be7337a59bb99e0ec7d639cefec36eea14ca /lib/sqlalchemy/orm
parent7439697ca3c8b07af79de6a146a15c34fc85d9d6 (diff)
downloadsqlalchemy-b050169600019ef249a8b315e7435c752623c900.tar.gz
Add caveat re: with_expression and already-loaded object
Adds a test for the populate_existing() behavior as well. Fixes: #5553 Change-Id: Ib0db6227c3fec7d0065f2a7caa36b3fd94ef14fd
Diffstat (limited to 'lib/sqlalchemy/orm')
-rw-r--r--lib/sqlalchemy/orm/strategy_options.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/strategy_options.py b/lib/sqlalchemy/orm/strategy_options.py
index 6c6f0307d..53350cb8e 100644
--- a/lib/sqlalchemy/orm/strategy_options.py
+++ b/lib/sqlalchemy/orm/strategy_options.py
@@ -1682,6 +1682,12 @@ def with_expression(loadopt, key, expression):
:param expr: SQL expression to be applied to the attribute.
+ .. note:: the target attribute is populated only if the target object
+ is **not currently loaded** in the current :class:`_orm.Session`
+ unless the :meth:`_orm.Query.populate_existing` method is used.
+ Please refer to :ref:`mapper_querytime_expression` for complete
+ usage details.
+
.. seealso::
:ref:`mapper_querytime_expression`