diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2019-10-31 15:55:23 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2019-10-31 15:55:23 +0000 |
commit | a71fe131a45d3f51b2ecc5338e0851c20f9277b7 (patch) | |
tree | fd4f7f5f0f1216b320a6ce552dfacecf15320c1a /lib/sqlalchemy/orm | |
parent | 65466dec6346ad84340af1cf3e431020add0f9a5 (diff) | |
parent | 9b774743952fa4f459a914604cc8395175eca07e (diff) | |
download | sqlalchemy-a71fe131a45d3f51b2ecc5338e0851c20f9277b7.tar.gz |
Merge "omit_join=True is not supported"
Diffstat (limited to 'lib/sqlalchemy/orm')
-rw-r--r-- | lib/sqlalchemy/orm/relationships.py | 20 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/strategies.py | 1 |
2 files changed, 20 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/relationships.py b/lib/sqlalchemy/orm/relationships.py index a8013f36d..aa49b8c7c 100644 --- a/lib/sqlalchemy/orm/relationships.py +++ b/lib/sqlalchemy/orm/relationships.py @@ -817,7 +817,16 @@ class RelationshipProperty(StrategizedProperty): :param omit_join: Allows manual control over the "selectin" automatic join optimization. Set to ``False`` to disable the "omit join" feature - added in SQLAlchemy 1.3. + added in SQLAlchemy 1.3; or leave as ``None`` to leave automatic + optimization in place. + + .. note:: This flag may only be set to ``False``. It is not + necessary to set it to ``True`` as the "omit_join" optimization is + automatically detected; if it is not detected, then the + optimization is not supported. + + .. versionchanged:: 1.3.11 setting ``omit_join`` to True will now + emit a warning as this was not the intended use of this flag. .. versionadded:: 1.3 @@ -848,6 +857,15 @@ class RelationshipProperty(StrategizedProperty): self.doc = doc self.active_history = active_history self.join_depth = join_depth + if omit_join: + util.warn( + "setting omit_join to True is not supported; selectin " + "loading of this relationship may not work correctly if this " + "flag is set explicitly. omit_join optimization is " + "automatically detected for conditions under which it is " + "supported." + ) + self.omit_join = omit_join self.local_remote_pairs = _local_remote_pairs self.bake_queries = bake_queries diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py index 59877a521..44ef43418 100644 --- a/lib/sqlalchemy/orm/strategies.py +++ b/lib/sqlalchemy/orm/strategies.py @@ -2167,6 +2167,7 @@ class SelectInLoader(PostLoader, util.MemoizedSlots): use_proxies=True, equivalents=self.parent._equivalent_columns, ) + if self.omit_join: if is_m2o: self._query_info = self._init_for_omit_join_m2o() |