Changeset 433 for elixir/trunk
- Timestamp:
- 12/17/08 16:01:02 (3 years ago)
- Location:
- elixir/trunk
- Files:
-
- 2 modified
-
elixir/entity.py (modified) (4 diffs)
-
tests/test_inherit.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
elixir/trunk/elixir/entity.py
r432 r433 44 44 self.module = sys.modules.get(entity.__module__) 45 45 46 # used for multi-table inheritance 47 self.join_condition = None 46 48 self.has_pk = False 47 49 self._pk_col_done = False … … 175 177 parent_desc = self.parent._descriptor 176 178 tablename = parent_desc.table_fullname 179 join_clauses = [] 177 180 for pk_col in parent_desc.primary_keys: 178 181 colname = options.MULTIINHERITANCECOL_NAMEFORMAT % \ … … 188 191 primary_key=True) 189 192 self.add_column(col) 193 join_clauses.append(col == pk_col) 194 self.join_condition = and_(*join_clauses) 190 195 elif self.inheritance == 'concrete': 191 196 # Copy primary key columns from the parent. … … 379 384 # non-polymorphic concrete doesn't need this 380 385 kwargs['inherits'] = self.parent.mapper 386 387 if self.inheritance == 'multi' and self.parent: 388 kwargs['inherit_condition'] = self.join_condition 381 389 382 390 if self.polymorphic: -
elixir/trunk/tests/test_inherit.py
r432 r433 158 158 data = Field(String(50)) 159 159 some_c = ManyToOne('C') 160 some_a = ManyToOne('A') 160 161 161 162 class C(A): … … 174 175 for a in A.query.all(): 175 176 if isinstance(a, (B, C)): 177 # On SA 0.4.x, this test works whether with_polymorphic is 178 # specified or not, because in 0.4.x, without with_polymorphic, 179 # it issues as many queries as necessary to load all data, 180 # while in 0.5, columns are "deferred". 176 181 assert 'data' in a.__dict__ 177 182
