diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-04-20 15:49:33 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-04-20 15:49:33 -0400 |
| commit | 0c560edee7d620bc2c4fcd820c1c04a3673d9b88 (patch) | |
| tree | 7ea4d3ef5e57fd6fdee111c066c4b34a02ba117d /lib/sqlalchemy/schema.py | |
| parent | b364021ee9622eb0e19d9eed0e1d257ec5e395d9 (diff) | |
| download | sqlalchemy-0c560edee7d620bc2c4fcd820c1c04a3673d9b88.tar.gz | |
- Added explicit check for when Column .name
is assigned as blank string [ticket:2140]
Diffstat (limited to 'lib/sqlalchemy/schema.py')
| -rw-r--r-- | lib/sqlalchemy/schema.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index 45762490b..bff3e8d63 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -901,15 +901,17 @@ class Column(SchemaItem, expression.ColumnClause): ["%s=%s" % (k, repr(getattr(self, k))) for k in kwarg]) def _set_parent(self, table): - if self.name is None: + if not self.name: raise exc.ArgumentError( - "Column must be constructed with a name or assign .name " - "before adding to a Table.") + "Column must be constructed with a non-blank name or " + "assign a non-blank .name before adding to a Table.") if self.key is None: self.key = self.name if getattr(self, 'table', None) is not None: - raise exc.ArgumentError("this Column already has a table!") + raise exc.ArgumentError( + "Column object already assigned to Table '%s'" % + self.table.description) if self.key in table._columns: col = table._columns.get(self.key) |
