diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-08-27 16:04:16 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-08-27 16:04:16 -0400 |
| commit | 640625bc9e98dd4060a1e61c717ddc98f8b3808b (patch) | |
| tree | 8c8e19184af6c70ccc382d4f86111dae8c3ffdfe /lib/sqlalchemy/ext/declarative/base.py | |
| parent | 326f2e4f60744d8073eaa4eda69d1dbb46bc9f50 (diff) | |
| download | sqlalchemy-640625bc9e98dd4060a1e61c717ddc98f8b3808b.tar.gz | |
- [feature] Conflicts between columns on
single-inheritance declarative subclasses,
with or without using a mixin, can be resolved
using a new @declared_attr usage described
in the documentation. [ticket:2472]
Diffstat (limited to 'lib/sqlalchemy/ext/declarative/base.py')
| -rw-r--r-- | lib/sqlalchemy/ext/declarative/base.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/ext/declarative/base.py b/lib/sqlalchemy/ext/declarative/base.py index 0348da744..e42ec2645 100644 --- a/lib/sqlalchemy/ext/declarative/base.py +++ b/lib/sqlalchemy/ext/declarative/base.py @@ -254,7 +254,6 @@ def _as_declarative(cls, classname, dict_): "Can't place __table_args__ on an inherited class " "with no table." ) - # add any columns declared here to the inherited table. for c in declared_columns: if c.primary_key: @@ -263,6 +262,8 @@ def _as_declarative(cls, classname, dict_): "class with no table." ) if c.name in inherited_table.c: + if inherited_table.c[c.name] is c: + continue raise exc.ArgumentError( "Column '%s' on class %s conflicts with " "existing column '%s'" % @@ -354,7 +355,6 @@ class _MapperConfig(object): # note here we place the subclass column # first. See [ticket:1892] for background. properties[k] = [col] + p.columns - result_mapper_args = mapper_args.copy() result_mapper_args['properties'] = properties return result_mapper_args |
