summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/declarative
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-05-30 15:36:13 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-05-30 15:36:13 -0400
commit8daa6ccfb0be6486d36ebdd3cd709e8ebfbfa207 (patch)
tree6435d73175d211d02a7046a4cf8e0f0d32eb43e6 /lib/sqlalchemy/ext/declarative
parent2da30fde12e312dd9ea7dfff41f50cee93fc0793 (diff)
downloadsqlalchemy-8daa6ccfb0be6486d36ebdd3cd709e8ebfbfa207.tar.gz
- The ``__mapper_args__`` dictionary is copied from a declarative
mixin or abstract class when accessed, so that modifications made to this dictionary by declarative itself won't conflict with that of other mappings. The dictionary is modified regarding the ``version_id_col`` and ``polymorphic_on`` arguments, replacing the column within with the one that is officially mapped to the local class/table. fixes #3062
Diffstat (limited to 'lib/sqlalchemy/ext/declarative')
-rw-r--r--lib/sqlalchemy/ext/declarative/base.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sqlalchemy/ext/declarative/base.py b/lib/sqlalchemy/ext/declarative/base.py
index eb66f12b6..0e68faa03 100644
--- a/lib/sqlalchemy/ext/declarative/base.py
+++ b/lib/sqlalchemy/ext/declarative/base.py
@@ -73,7 +73,10 @@ def _as_declarative(cls, classname, dict_):
# don't even invoke __mapper_args__ until
# after we've determined everything about the
# mapped table.
- mapper_args_fn = lambda: cls.__mapper_args__
+ # make a copy of it so a class-level dictionary
+ # is not overwritten when we update column-based
+ # arguments.
+ mapper_args_fn = lambda: dict(cls.__mapper_args__)
elif name == '__tablename__':
if not tablename and (
not class_mapped or