summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2018-10-31 15:25:06 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2018-10-31 15:25:06 +0000
commit448db7ac4ccac4fe0400837379ef341f0be3143e (patch)
tree770f21994e11d16bac38ce1fc380019dad903907 /lib
parent353d416341d33ce4122a9becde45e75fbe479752 (diff)
parent6ec2246d04e3608a024b1425207c80c73fa78218 (diff)
downloadsqlalchemy-448db7ac4ccac4fe0400837379ef341f0be3143e.tar.gz
Merge "Move pk on single-inh subclass check below conflict resolution check" into rel_1_2
Diffstat (limited to 'lib')
-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: