Commits

Mike Bayer committed 5fa46d5

merged select([literal('foo')]) fix from trunk r4933

Comments (0)

Files changed (3)

 =======
 CHANGES
 =======
+
 0.4.7
 =====
 - orm
     - Removed erroneous 'self' reference when raising
       UnmappedColumnError during flush() operation.
 
+- sql
+    - Fixed bug when calling select([literal('foo')])
+      or select([bindparam('foo')]).
+      
 - schema
     - create_all(), drop_all(), create(), drop() all raise
       an error if the table name or schema name contains

lib/sqlalchemy/sql/compiler.py

             column.table is not None and \
             not isinstance(column.table, sql.Select):
             return column.label(column.name)
-        elif not isinstance(column, (sql._UnaryExpression, sql._TextClause)) and (not hasattr(column, 'name') or isinstance(column, sql._Function)):
+        elif not isinstance(column, (sql._UnaryExpression, sql._TextClause, sql._BindParamClause)) and (not hasattr(column, 'name') or isinstance(column, sql._Function)):
             return column.label(column.anon_label)
         else:
             return column

test/sql/select.py

         
 
     def test_literal(self):
+        
+        self.assert_compile(select([literal('foo')]), "SELECT :param_1")
+        
         self.assert_compile(select([literal("foo") + literal("bar")], from_obj=[table1]),
             "SELECT :param_1 || :param_2 AS anon_1 FROM mytable")