diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-03-16 17:28:41 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-04-03 12:14:33 -0400 |
commit | 7bb4923391f98db517dde59d813322a948d10bfe (patch) | |
tree | 7221ab187fa4307a116d1a6fc3100ad4122515c7 /lib/sqlalchemy/sql/selectable.py | |
parent | b32a0fd286de3cd4cbfd248d74e200985d7e214a (diff) | |
download | sqlalchemy-7bb4923391f98db517dde59d813322a948d10bfe.tar.gz |
Use consistent method signature for Alias.self_group()
Fixed bug where the use of an :class:`.Alias` object in a column
context would raise an argument error when it tried to group itself
into a parenthesized expression. Using :class:`.Alias` in this way
is not yet a fully supported API, however it applies to some end-user
recipes and may have a more prominent role in support of some
future Postgresql features.
Change-Id: I81717e30416e0350f08d1e022c3d84656e0a9735
Fixes: #3939
Diffstat (limited to 'lib/sqlalchemy/sql/selectable.py')
-rw-r--r-- | lib/sqlalchemy/sql/selectable.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py index b69d667c6..9db1e0844 100644 --- a/lib/sqlalchemy/sql/selectable.py +++ b/lib/sqlalchemy/sql/selectable.py @@ -1241,13 +1241,13 @@ class Alias(FromClause): or 'anon')) self.name = name - def self_group(self, target=None): - if isinstance(target, CompoundSelect) and \ + def self_group(self, against=None): + if isinstance(against, CompoundSelect) and \ isinstance(self.original, Select) and \ self.original._needs_parens_for_grouping(): return FromGrouping(self) - return super(Alias, self).self_group(target) + return super(Alias, self).self_group(against=against) @property def description(self): @@ -2269,7 +2269,7 @@ class CompoundSelect(GenerativeSelect): n + 1, len(s.c._all_columns)) ) - self.selects.append(s.self_group(self)) + self.selects.append(s.self_group(against=self)) GenerativeSelect.__init__(self, **kwargs) |