summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2018-11-30 14:36:20 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2018-11-30 14:36:20 -0500
commitfb05e085fe48a1c48fcb4bcf89ba58c0d7584b8c (patch)
treeae7ce08b13c97c1b0d673862cc3ac0ed4425f4b8 /lib
parent0a0b36686d5da0e7d04974c8df0ece574b71f3cb (diff)
downloadsqlalchemy-fb05e085fe48a1c48fcb4bcf89ba58c0d7584b8c.tar.gz
Apply path generation for superclasses to Load._set_path_strategy()
Extended the fix first made as part of :ticket:`3287`, where a loader option made against a subclass using a wildcard would extend itself to include application of the wildcard to attributes on the super classes as well, to a "bound" loader option as well, e.g. in an expression like ``Load(SomeSubClass).load_only('foo')``. Columns that are part of the parent class of ``SomeSubClass`` will also be excluded in the same way as if the unbound option ``load_only('foo')`` were used. Fixes: #4373 Change-Id: I2eee0e587c34323a77df077b9cb699da370c403d
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/orm/strategy_options.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/sqlalchemy/orm/strategy_options.py b/lib/sqlalchemy/orm/strategy_options.py
index af9bd71b6..0ef34b0b9 100644
--- a/lib/sqlalchemy/orm/strategy_options.py
+++ b/lib/sqlalchemy/orm/strategy_options.py
@@ -357,9 +357,15 @@ class Load(Generative, MapperOption):
else:
effective_path = self.path
- self._set_for_path(
- self.context, effective_path, replace=True,
- merge_opts=self.is_opts_only)
+ if effective_path.is_token:
+ for path in effective_path.generate_for_superclasses():
+ self._set_for_path(
+ self.context, path, replace=True,
+ merge_opts=self.is_opts_only)
+ else:
+ self._set_for_path(
+ self.context, effective_path, replace=True,
+ merge_opts=self.is_opts_only)
def __getstate__(self):
d = self.__dict__.copy()