summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2018-10-31 15:24:55 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2018-10-31 15:24:55 +0000
commitabb12a9d81161ff01b5cde2740746d5da32c69a2 (patch)
tree61da0108be8cef67d02501f0c3a8316157d061eb /lib/sqlalchemy
parent4c487b9477de353b1eb90040a038cabf8787e97d (diff)
parent3ed79a5c18c14d842280805d1dae8a9c99ec8f18 (diff)
downloadsqlalchemy-abb12a9d81161ff01b5cde2740746d5da32c69a2.tar.gz
Merge "Move pk on single-inh subclass check below conflict resolution check"
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 a6642364d..e5bc670b3 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: