summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2009-01-13 15:45:59 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2009-01-13 15:45:59 +0000
commit3e3f309cf99b0123be4e7295891e5531b137e1fb (patch)
treef80543a47b33c12839cc041ed17e98915175532b /lib/sqlalchemy/ext
parentb99bdc7cee1080e6fd86451c5def2410a697c0b9 (diff)
downloadsqlalchemy-3e3f309cf99b0123be4e7295891e5531b137e1fb.tar.gz
- It's an error to add new Column objects to a declarative class
that specified an existing table using __table__.
Diffstat (limited to 'lib/sqlalchemy/ext')
-rw-r--r--lib/sqlalchemy/ext/declarative.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/ext/declarative.py b/lib/sqlalchemy/ext/declarative.py
index 70f50622d..cf47279e8 100644
--- a/lib/sqlalchemy/ext/declarative.py
+++ b/lib/sqlalchemy/ext/declarative.py
@@ -478,7 +478,9 @@ def _as_declarative(cls, classname, dict_):
*(tuple(cols) + tuple(args)), **table_kw)
else:
table = cls.__table__
-
+ if cols:
+ raise exceptions.ArgumentError("Can't add additional columns when specifying __table__")
+
mapper_args = getattr(cls, '__mapper_args__', {})
if 'inherits' not in mapper_args:
inherits = cls.__mro__[1]
@@ -530,7 +532,7 @@ def _as_declarative(cls, classname, dict_):
mapper_args['exclude_properties'] = exclude_properties = \
set([c.key for c in inherited_table.c if c not in inherited_mapper._columntoproperty])
exclude_properties.difference_update([c.key for c in cols])
-
+
cls.__mapper__ = mapper_cls(cls, table, properties=our_stuff, **mapper_args)
class DeclarativeMeta(type):