summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2009-02-22 19:35:36 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2009-02-22 19:35:36 +0000
commitb60185a078ec7143d44f5980043f143d53a9caf3 (patch)
treed0531747b3bf3db5ddf2f5c4a3bf44e076845cbc /lib/sqlalchemy/ext
parente8b57a47cd3ffb4b7c43eb6e4eb1753d4379b1b9 (diff)
downloadsqlalchemy-b60185a078ec7143d44f5980043f143d53a9caf3.tar.gz
- Declarative will accept a table-bound column as a property
when used in conjunction with __table__, if the column is already present in __table__. The column will be remapped to the given key the same way as when added to the mapper() properties dict.
Diffstat (limited to 'lib/sqlalchemy/ext')
-rw-r--r--lib/sqlalchemy/ext/declarative.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/sqlalchemy/ext/declarative.py b/lib/sqlalchemy/ext/declarative.py
index 79677c084..084ec2699 100644
--- a/lib/sqlalchemy/ext/declarative.py
+++ b/lib/sqlalchemy/ext/declarative.py
@@ -480,7 +480,9 @@ def _as_declarative(cls, classname, dict_):
else:
table = cls.__table__
if cols:
- raise exceptions.ArgumentError("Can't add additional columns when specifying __table__")
+ for c in cols:
+ if not table.c.contains_column(c):
+ raise exceptions.ArgumentError("Can't add additional column %r when specifying __table__" % key)
mapper_args = getattr(cls, '__mapper_args__', {})
if 'inherits' not in mapper_args: