self._correlate = set()
self._froms = util.OrderedSet()
-
- if columns:
+
+ try:
+ cols_present = bool(columns)
+ except TypeError:
+ raise exc.ArgumentError("columns argument to select() must "
+ "be a Python list or other iterable")
+
+ if cols_present:
self._raw_columns = []
for c in columns:
c = _literal_as_column(c)
self.assert_compile(select([table1, table2]), "SELECT mytable.myid, mytable.name, mytable.description, myothertable.otherid, \
myothertable.othername FROM mytable, myothertable")
-
+
+ def test_invalid_col_argument(self):
+ assert_raises(exc.ArgumentError, select, table1)
+ assert_raises(exc.ArgumentError, select, table1.c.myid)
+
def test_from_subquery(self):
"""tests placing select statements in the column clause of another select, for the
purposes of selecting from the exported columns of that select."""