From 840a2fabb8999b4b3807dfa55d771627656ab1db Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 19 Jan 2008 18:36:52 +0000 Subject: - some expression fixup: - the '.c.' attribute on a selectable now gets an entry for every column expression in its columns clause; previously, "unnamed" columns like functions and CASE statements weren't getting put there. Now they will, using their full string representation if no 'name' is available. - The anonymous 'label' generated for otherwise unlabeled functions and expressions now propagates outwards at compile time for expressions like select([select([func.foo()])]) - a CompositeSelect, i.e. any union(), union_all(), intersect(), etc. now asserts that each selectable contains the same number of columns. This conforms to the corresponding SQL requirement. - building on the above ideas, CompositeSelects now build up their ".c." collection based on the names present in the first selectable only; corresponding_column() now works fully for all embedded selectables. --- lib/sqlalchemy/sql/compiler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/sql/compiler.py') diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 8f2e3372a..666a38d39 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -464,7 +464,7 @@ class DefaultCompiler(engine.Compiled): 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)): - return column.label(None) + return column.anon_label else: return column @@ -728,7 +728,7 @@ class DefaultCompiler(engine.Compiled): return "RELEASE SAVEPOINT %s" % self.preparer.format_savepoint(savepoint_stmt) def __str__(self): - return self.string + return self.string or '' class DDLBase(engine.SchemaIterator): def find_alterables(self, tables): -- cgit v1.2.1