summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/ext/declarative/base.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/sqlalchemy/ext/declarative/base.py b/lib/sqlalchemy/ext/declarative/base.py
index 8ce44b936..f2b708f9f 100644
--- a/lib/sqlalchemy/ext/declarative/base.py
+++ b/lib/sqlalchemy/ext/declarative/base.py
@@ -534,11 +534,6 @@ class _MapperConfig(object):
)
# add any columns declared here to the inherited table.
for c in declared_columns:
- if c.primary_key:
- raise exc.ArgumentError(
- "Can't place primary key columns on an inherited "
- "class with no table."
- )
if c.name in inherited_table.c:
if inherited_table.c[c.name] is c:
continue
@@ -547,6 +542,11 @@ class _MapperConfig(object):
"existing column '%s'" %
(c, cls, inherited_table.c[c.name])
)
+ if c.primary_key:
+ raise exc.ArgumentError(
+ "Can't place primary key columns on an inherited "
+ "class with no table."
+ )
inherited_table.append_column(c)
if inherited_mapped_table is not None and \
inherited_mapped_table is not inherited_table: