summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-01-19 18:36:52 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-01-19 18:36:52 +0000
commit840a2fabb8999b4b3807dfa55d771627656ab1db (patch)
tree5486020ddf87fd932c6fd563a6319eeea8265c6f /lib/sqlalchemy/sql/compiler.py
parent6d486fb2e77e338ac4d45ff5ed45561abb5c81b3 (diff)
downloadsqlalchemy-840a2fabb8999b4b3807dfa55d771627656ab1db.tar.gz
- 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.
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py4
1 files changed, 2 insertions, 2 deletions
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):