Removed unused branch in Query.change_aliases().
Unused since 0c7633178f
.
This commit is contained in:
parent
ad332e5ca9
commit
419de7b00d
|
@ -784,21 +784,15 @@ class Query(object):
|
||||||
"""
|
"""
|
||||||
assert set(change_map.keys()).intersection(set(change_map.values())) == set()
|
assert set(change_map.keys()).intersection(set(change_map.values())) == set()
|
||||||
|
|
||||||
def relabel_column(col):
|
|
||||||
if isinstance(col, (list, tuple)):
|
|
||||||
old_alias = col[0]
|
|
||||||
return (change_map.get(old_alias, old_alias), col[1])
|
|
||||||
else:
|
|
||||||
return col.relabeled_clone(change_map)
|
|
||||||
# 1. Update references in "select" (normal columns plus aliases),
|
# 1. Update references in "select" (normal columns plus aliases),
|
||||||
# "group by" and "where".
|
# "group by" and "where".
|
||||||
self.where.relabel_aliases(change_map)
|
self.where.relabel_aliases(change_map)
|
||||||
if isinstance(self.group_by, list):
|
if isinstance(self.group_by, list):
|
||||||
self.group_by = [relabel_column(col) for col in self.group_by]
|
self.group_by = [col.relabeled_clone(change_map) for col in self.group_by]
|
||||||
self.select = [col.relabeled_clone(change_map) for col in self.select]
|
self.select = [col.relabeled_clone(change_map) for col in self.select]
|
||||||
if self._annotations:
|
if self._annotations:
|
||||||
self._annotations = OrderedDict(
|
self._annotations = OrderedDict(
|
||||||
(key, relabel_column(col)) for key, col in self._annotations.items())
|
(key, col.relabeled_clone(change_map)) for key, col in self._annotations.items())
|
||||||
|
|
||||||
# 2. Rename the alias in the internal table/alias datastructures.
|
# 2. Rename the alias in the internal table/alias datastructures.
|
||||||
for old_alias, new_alias in six.iteritems(change_map):
|
for old_alias, new_alias in six.iteritems(change_map):
|
||||||
|
|
Loading…
Reference in New Issue