diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2019-01-18 16:31:14 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2019-01-18 16:31:14 +0000 |
| commit | 76d3be143396de200a58e74ab7023dfd1ba18694 (patch) | |
| tree | 6b43592a391c0ceb8631bec2c2f7cacd0ccf375a /lib/sqlalchemy | |
| parent | 894acf7b8eaa166a6ec231d0a139c699239b5008 (diff) | |
| parent | c8d7141c79829f36e123bf3e4be1721dd34aaeb4 (diff) | |
| download | sqlalchemy-76d3be143396de200a58e74ab7023dfd1ba18694.tar.gz | |
Merge "Adapt single inh criteria more specifically"
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/orm/mapper.py | 2 | ||||
| -rw-r--r-- | lib/sqlalchemy/orm/query.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index 56ad965de..a394ec06e 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -2103,7 +2103,7 @@ class Mapper(InspectionAttr): @_memoized_configured_property def _single_table_criterion(self): if self.single and self.inherits and self.polymorphic_on is not None: - return self.polymorphic_on.in_( + return self.polymorphic_on._annotate({"parentmapper": self}).in_( m.polymorphic_identity for m in self.self_and_descendants ) else: diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py index 7ddcf10b0..2bd79a2cd 100644 --- a/lib/sqlalchemy/orm/query.py +++ b/lib/sqlalchemy/orm/query.py @@ -364,7 +364,6 @@ class Query(object): or "_orm_adapt" in elem._annotations or "parententity" in elem._annotations ): - e = adapter(elem) if e is not None: return e @@ -3933,6 +3932,7 @@ class Query(object): if single_crit is not None: if adapter: single_crit = adapter.traverse(single_crit) + single_crit = self._adapt_clause(single_crit, False, False) context.whereclause = sql.and_( sql.True_._ifnone(context.whereclause), single_crit |
