Select would fail if a selectable were passed.
[ticket:2270]. Also in 0.6.9.
such that the "froms" collection can be cleared
and re-generated at any time. [ticket:2261]
+ - Fixed bug whereby with_only_columns() method of
+ Select would fail if a selectable were passed.
+ [ticket:2270]. Also in 0.6.9.
+
- schema
- Added a slightly nicer __repr__() to SchemaItem
classes. Note the repr here can't fully support
"""
self._reset_exported()
- self._raw_columns = [
- isinstance(c, _ScalarSelect) and
- c.self_group(against=operators.comma_op) or c
- for c in [_literal_as_column(c) for c in columns]
- ]
+ rc = []
+ for c in columns:
+ c = _literal_as_column(c)
+ if isinstance(c, _ScalarSelect):
+ c = c.self_group(against=operators.comma_op)
+ rc.append(c)
+ self._raw_columns = rc
@_generative
def where(self, whereclause):
sel3 = visitors.ReplacingCloningVisitor().traverse(sel2)
assert sel3.corresponding_column(col) is sel3.c.foo
+ def test_with_only_generative(self):
+ s1 = table1.select().as_scalar()
+ self.assert_compile(
+ s1.with_only_columns([s1]),
+ "SELECT (SELECT table1.col1, table1.col2, "
+ "table1.col3, table1.colx FROM table1) AS anon_1"
+ )
+
def test_select_on_table(self):
sel = select([table1, table2], use_labels=True)