Changeset 433 for elixir/trunk/elixir

Show
Ignore:
Timestamp:
12/17/08 16:01:02 (3 years ago)
Author:
ged
Message:

revert part of previous commit... SA can't possibly compute itself the
inherit_condition when there are several FK from the child table to the parent
table

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • elixir/trunk/elixir/entity.py

    r432 r433  
    4444        self.module = sys.modules.get(entity.__module__) 
    4545 
     46        # used for multi-table inheritance 
     47        self.join_condition = None 
    4648        self.has_pk = False 
    4749        self._pk_col_done = False 
     
    175177                    parent_desc = self.parent._descriptor 
    176178                    tablename = parent_desc.table_fullname 
     179                    join_clauses = [] 
    177180                    for pk_col in parent_desc.primary_keys: 
    178181                        colname = options.MULTIINHERITANCECOL_NAMEFORMAT % \ 
     
    188191                                     primary_key=True) 
    189192                        self.add_column(col) 
     193                        join_clauses.append(col == pk_col) 
     194                    self.join_condition = and_(*join_clauses) 
    190195                elif self.inheritance == 'concrete': 
    191196                    # Copy primary key columns from the parent. 
     
    379384                # non-polymorphic concrete doesn't need this 
    380385                kwargs['inherits'] = self.parent.mapper 
     386 
     387            if self.inheritance == 'multi' and self.parent: 
     388                kwargs['inherit_condition'] = self.join_condition 
    381389 
    382390            if self.polymorphic: