summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2009-02-16 23:49:53 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2009-02-16 23:49:53 +0000
commite329fb31782123fb3fbc840a6f551a67213c5d17 (patch)
tree55d2731e317c668200369012ed934f1a30aea2fa /lib/sqlalchemy
parent2cee9cb24378920c08e20a922bc22f0ab28c74f0 (diff)
downloadsqlalchemy-e329fb31782123fb3fbc840a6f551a67213c5d17.tar.gz
- Declarative figures out joined-table inheritance primary join
condition even if "inherits" mapper argument is given explicitly. Allows mixins to be used with joined table inheritance.
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/ext/declarative.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/sqlalchemy/ext/declarative.py b/lib/sqlalchemy/ext/declarative.py
index 3b4880403..0fec835ed 100644
--- a/lib/sqlalchemy/ext/declarative.py
+++ b/lib/sqlalchemy/ext/declarative.py
@@ -487,14 +487,6 @@ def _as_declarative(cls, classname, dict_):
inherits = cls._decl_class_registry.get(inherits.__name__, None)
if inherits:
mapper_args['inherits'] = inherits
- if not mapper_args.get('concrete', False) and table and 'inherit_condition' not in mapper_args:
- # figure out the inherit condition with relaxed rules
- # about nonexistent tables, to allow for ForeignKeys to
- # not-yet-defined tables (since we know for sure that our
- # parent table is defined within the same MetaData)
- mapper_args['inherit_condition'] = sql_util.join_condition(
- inherits.__table__, table,
- ignore_nonexistent_tables=True)
if hasattr(cls, '__mapper_cls__'):
mapper_cls = util.unbound_method_to_callable(cls.__mapper_cls__)
@@ -508,6 +500,14 @@ def _as_declarative(cls, classname, dict_):
elif 'inherits' in mapper_args and not mapper_args.get('concrete', False):
inherited_mapper = class_mapper(mapper_args['inherits'], compile=False)
inherited_table = inherited_mapper.local_table
+ if 'inherit_condition' not in mapper_args and table:
+ # figure out the inherit condition with relaxed rules
+ # about nonexistent tables, to allow for ForeignKeys to
+ # not-yet-defined tables (since we know for sure that our
+ # parent table is defined within the same MetaData)
+ mapper_args['inherit_condition'] = sql_util.join_condition(
+ mapper_args['inherits'].__table__, table,
+ ignore_nonexistent_tables=True)
if not table:
# single table inheritance.