determines what's in it's '.c' collection.
Behaves identically, except that a
raw ClauseList() passed to select([])
(which is not a documented case anyway) will
now be expanded into its individual column
elements instead of being ignored.
=======
CHANGES
=======
+0.7.1
+=====
+
+- sql
+ - Streamlined the process by which a Select
+ determines what's in it's '.c' collection.
+ Behaves identically, except that a
+ raw ClauseList() passed to select([])
+ (which is not a documented case anyway) will
+ now be expanded into its individual column
+ elements instead of being ignored.
+
0.7.0
=======
- This section documents those changes from 0.7b4
self._froms = self._froms.union([fromclause])
- def __exportable_columns(self):
- for column in self._raw_columns:
- if isinstance(column, Selectable):
- for co in column.columns:
- yield co
- elif isinstance(column, ColumnElement):
- yield column
- else:
- continue
def _populate_column_collection(self):
- for c in self.__exportable_columns():
- c._make_proxy(self, name=self.use_labels and c._label or None)
+ for c in self.inner_columns:
+ if hasattr(c, '_make_proxy'):
+ c._make_proxy(self, name=self.use_labels and c._label or None)
def self_group(self, against=None):
"""return a 'grouping' construct as per the ClauseElement
"SELECT c FROM (SELECT (SELECT (SELECT table1.col1 AS a FROM table1) AS b) AS c)"
)
+ def test_unusual_column_elements_text(self):
+ """test that .c excludes text()."""
+
+ s = select([table1.c.col1, text("foo")])
+ eq_(
+ list(s.c),
+ [s.c.col1]
+ )
+
+ def test_unusual_column_elements_clauselist(self):
+ """Test that raw ClauseList is expanded into .c."""
+
+ from sqlalchemy.sql.expression import ClauseList
+ s = select([table1.c.col1, ClauseList(table1.c.col2, table1.c.col3)])
+ eq_(
+ list(s.c),
+ [s.c.col1, s.c.col2, s.c.col3]
+ )
+
+ def test_unusual_column_elements_boolean_clauselist(self):
+ """test that BooleanClauseList is placed as single element in .c."""
+
+ c2 = and_(table1.c.col2==5, table1.c.col3==4)
+ s = select([table1.c.col1, c2])
+ eq_(
+ list(s.c),
+ [s.c.col1, s.corresponding_column(c2)]
+ )
class AnonLabelTest(fixtures.TestBase):
"""Test behaviors that we hope to change with [ticket:2168]."""