diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-09-18 13:18:44 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-09-18 13:18:44 -0400 |
commit | 003149c504149849c679a60a1f346a0f0393dce0 (patch) | |
tree | 277f62e174b557001792168e60e8a7b288b67959 /lib/sqlalchemy/sql/compiler.py | |
parent | c9d7e387803a7cf7d3bcd22b0ba10bdbe2718e92 (diff) | |
download | sqlalchemy-003149c504149849c679a60a1f346a0f0393dce0.tar.gz |
- An informative error message is raised if a Column
which has not yet been assigned a name, i.e. as in
declarative, is used in a context where it is
exported to the columns collection of an enclosing
select() construct, or if any construct involving
that column is compiled before its name is
assigned. [ticket:1862]
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index fcff5e355..e47db7e28 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -332,6 +332,10 @@ class SQLCompiler(engine.Compiled): def visit_column(self, column, result_map=None, **kwargs): name = column.name + if name is None: + raise exc.CompileError("Cannot compile Column object until " + "it's 'name' is assigned.") + if not column.is_literal and isinstance(name, sql._generated_label): name = self._truncated_identifier("colident", name) |