diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-10-06 20:29:08 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-10-06 20:29:08 -0400 |
commit | 1b25ed907fb7311d28d2273c9b9858b50c1a7afc (patch) | |
tree | 74bd8df8638dbd1f1e48b1ca660963944be0be3d /lib/sqlalchemy/orm/relationships.py | |
parent | d79e1d69a6b2d0d1cc18d3d9d0283ef4a77925bc (diff) | |
download | sqlalchemy-1b25ed907fb7311d28d2273c9b9858b50c1a7afc.tar.gz |
- merge ticket_1418 branch, [ticket:1418]
- The system of loader options has been entirely rearchitected to build
upon a much more comprehensive base, the :class:`.Load` object. This
base allows any common loader option like :func:`.joinedload`,
:func:`.defer`, etc. to be used in a "chained" style for the purpose
of specifying options down a path, such as ``joinedload("foo").subqueryload("bar")``.
The new system supersedes the usage of dot-separated path names,
multiple attributes within options, and the usage of ``_all()`` options.
- Added a new load option :func:`.orm.load_only`. This allows a series
of column names to be specified as loading "only" those attributes,
deferring the rest.
Diffstat (limited to 'lib/sqlalchemy/orm/relationships.py')
-rw-r--r-- | lib/sqlalchemy/orm/relationships.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/sqlalchemy/orm/relationships.py b/lib/sqlalchemy/orm/relationships.py index f37bb8a4d..2393df26b 100644 --- a/lib/sqlalchemy/orm/relationships.py +++ b/lib/sqlalchemy/orm/relationships.py @@ -83,7 +83,7 @@ class RelationshipProperty(StrategizedProperty): """ - strategy_wildcard_key = 'relationship:*' + strategy_wildcard_key = 'relationship' _dependency_processor = None @@ -638,8 +638,7 @@ class RelationshipProperty(StrategizedProperty): if strategy_class: self.strategy_class = strategy_class else: - self.strategy_class = self._strategy_lookup(lazy=self.lazy) - self._lazy_strategy = self._strategy_lookup(lazy="select") + self.strategy_class = self._strategy_lookup(("lazy", self.lazy)) self._reverse_property = set() @@ -1149,7 +1148,7 @@ class RelationshipProperty(StrategizedProperty): alias_secondary=True): if value is not None: value = attributes.instance_state(value) - return self._get_strategy(self._lazy_strategy).lazy_clause(value, + return self._lazy_strategy.lazy_clause(value, reverse_direction=not value_is_parent, alias_secondary=alias_secondary, adapt_source=adapt_source) @@ -1361,6 +1360,8 @@ class RelationshipProperty(StrategizedProperty): self._post_init() self._generate_backref() super(RelationshipProperty, self).do_init() + self._lazy_strategy = self._get_strategy((("lazy", "select"),)) + def _process_dependent_arguments(self): """Convert incoming configuration arguments to their @@ -1602,7 +1603,7 @@ class RelationshipProperty(StrategizedProperty): """memoize the 'use_get' attribute of this RelationshipLoader's lazyloader.""" - strategy = self._get_strategy(self._lazy_strategy) + strategy = self._lazy_strategy return strategy.use_get @util.memoized_property |