]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
have polymorphic_union render the 'literal' in a type-specific way
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 17 Apr 2010 17:00:23 +0000 (13:00 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 17 Apr 2010 17:00:23 +0000 (13:00 -0400)
lib/sqlalchemy/orm/util.py

index 63b9d565f4d94ead545d6c54c01289770411eb49..03f8c0c3758a5822409fbac09d6fcff5fc0b604b 100644 (file)
@@ -117,8 +117,10 @@ def polymorphic_union(table_map, typecolname, aliasname='p_union'):
     for type, table in table_map.iteritems():
         if typecolname is not None:
             result.append(sql.select([col(name, table) for name in colnames] +
-                                     [sql.literal_column("'%s'" % type).label(typecolname)],
-                                     from_obj=[table]))
+                             [sql.literal_column(
+                                sql_util._quote_ddl_expr(type)).label(typecolname)
+                              ],
+                             from_obj=[table]))
         else:
             result.append(sql.select([col(name, table) for name in colnames],
                                      from_obj=[table]))