summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/util.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-04-07 14:18:22 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-04-13 14:22:59 -0400
commitb7644319e85ce38c1a576802317a9058a6aed82d (patch)
tree12db3074d79d0c54deb247a7e79424312e183cf3 /lib/sqlalchemy/orm/util.py
parent755da1797432ee98dd3d1d309026a21529b45f75 (diff)
downloadsqlalchemy-b7644319e85ce38c1a576802317a9058a6aed82d.tar.gz
Use baked lazyloading by default
The ``lazy="select"`` loader strategy now makes used of the :class:`.BakedQuery` query caching system in all cases. This removes most overhead of generating a :class:`.Query` object and running it into a :func:`.select` and then string SQL statement from the process of lazy-loading related collections and objects. The "baked" lazy loader has also been improved such that it can now cache in most cases where query load options are used. Change-Id: Ic96792fffaa045ae9aa0a4657d6d29235d3efb85 Fixes: #3954
Diffstat (limited to 'lib/sqlalchemy/orm/util.py')
-rw-r--r--lib/sqlalchemy/orm/util.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py
index 73b0be99c..2e61661ed 100644
--- a/lib/sqlalchemy/orm/util.py
+++ b/lib/sqlalchemy/orm/util.py
@@ -1039,6 +1039,19 @@ def was_deleted(object):
state = attributes.instance_state(object)
return state.was_deleted
+def _entity_corresponds_to(given, entity):
+ if entity.is_aliased_class:
+ if given.is_aliased_class:
+ if entity._base_alias is given._base_alias:
+ return True
+ return False
+ elif given.is_aliased_class:
+ if given._use_mapper_path:
+ return entity in given.with_polymorphic_mappers
+ else:
+ return entity is given
+
+ return entity.common_parent(given)
def randomize_unitofwork():
"""Use random-ordering sets within the unit of work in order