From: Mike Bayer Date: Sat, 17 Apr 2010 17:00:23 +0000 (-0400) Subject: have polymorphic_union render the 'literal' in a type-specific way X-Git-Tag: rel_0_6_0~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=99dc6b88670435158f06f1451e3092300f8f8734;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git have polymorphic_union render the 'literal' in a type-specific way --- diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py index 63b9d565f4..03f8c0c375 100644 --- a/lib/sqlalchemy/orm/util.py +++ b/lib/sqlalchemy/orm/util.py @@ -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]))