summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/orm/interfaces.py4
-rw-r--r--lib/sqlalchemy/orm/strategies.py3
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/sqlalchemy/orm/interfaces.py b/lib/sqlalchemy/orm/interfaces.py
index 5c6a92325..358e1297f 100644
--- a/lib/sqlalchemy/orm/interfaces.py
+++ b/lib/sqlalchemy/orm/interfaces.py
@@ -149,8 +149,8 @@ class StrategizedProperty(MapperProperty):
except KeyError:
# cache the located strategy per class for faster re-lookup
strategy = cls(self)
- strategy.init()
strategy.is_default = False
+ strategy.init()
self._all_strategies[cls] = strategy
return strategy
@@ -282,7 +282,7 @@ class LoaderStrategy(object):
def init(self):
self.parent = self.parent_property.parent
self.key = self.parent_property.key
-
+
def init_class_attribute(self):
pass
diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py
index e9d992d18..ee80b3477 100644
--- a/lib/sqlalchemy/orm/strategies.py
+++ b/lib/sqlalchemy/orm/strategies.py
@@ -317,7 +317,8 @@ class EagerLoader(AbstractRelationLoader):
"to child class '%s': Cant use eager loading on a self "
"referential relationship." %
(self.key, repr(self.parent.class_), repr(self.mapper.class_)))
- self.parent._eager_loaders.add(self.parent_property)
+ if self.is_default:
+ self.parent._eager_loaders.add(self.parent_property)
self.clauses = {}
self.clauses_by_lead_mapper = {}