summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-08-15 18:42:59 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-08-15 18:42:59 -0400
commit54808ecccd9f6e7907f4762f6df33e1ad303189c (patch)
treedc70f48d77371ea44c6422e243b96ce4fd1c329f /lib/sqlalchemy/ext
parent6d8643a1560015de0fefefc7a0ca87b1cc9ce3fd (diff)
downloadsqlalchemy-54808ecccd9f6e7907f4762f6df33e1ad303189c.tar.gz
- [bug] Declarative can now propagate a column
declared on a single-table inheritance subclass up to the parent class' table, when the parent class is itself mapped to a join() or select() statement, directly or via joined inheritane, and not just a Table. [ticket:2549]
Diffstat (limited to 'lib/sqlalchemy/ext')
-rw-r--r--lib/sqlalchemy/ext/declarative/base.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/sqlalchemy/ext/declarative/base.py b/lib/sqlalchemy/ext/declarative/base.py
index 100a68678..0348da744 100644
--- a/lib/sqlalchemy/ext/declarative/base.py
+++ b/lib/sqlalchemy/ext/declarative/base.py
@@ -244,6 +244,7 @@ def _as_declarative(cls, classname, dict_):
elif inherits:
inherited_mapper = _declared_mapping_info(inherits)
inherited_table = inherited_mapper.local_table
+ inherited_mapped_table = inherited_mapper.mapped_table
if table is None:
# single table inheritance.
@@ -268,6 +269,9 @@ def _as_declarative(cls, classname, dict_):
(c, cls, inherited_table.c[c.name])
)
inherited_table.append_column(c)
+ if inherited_mapped_table is not None and \
+ inherited_mapped_table is not inherited_table:
+ inherited_mapped_table._refresh_for_new_column(c)
mt = _MapperConfig(mapper_cls,
cls, table,
@@ -281,6 +285,7 @@ def _as_declarative(cls, classname, dict_):
class _MapperConfig(object):
configs = util.OrderedDict()
+ mapped_table = None
def __init__(self, mapper_cls,
cls,