__mapper_args__ when using declarative.
- Adjustments to the enhanced garbage collection on
InstanceState to better guard against errors due
to lost state.
-
+
- Query.get() returns a more informative
error message when executed against multiple entities.
[ticket:1220]
schemas, particularly when those schemas are the
default schema. [ticket:1217]
+- ext
+ - Can now use a custom "inherit_condition" in
+ __mapper_args__ when using declarative.
+
0.5.0rc3
========
- features
inherits = cls._decl_class_registry.get(inherits.__name__, None)
if inherits:
mapper_args['inherits'] = inherits
- if not mapper_args.get('concrete', False) and table:
+ 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
sess.flush()
eq_(sess.query(User).filter(User.name == "SOMENAME someuser").one(), u1)
+ def test_custom_inh(self):
+ class Foo(Base):
+ __tablename__ = 'foo'
+ id = Column('id', Integer, primary_key=True)
+
+ class Bar(Foo):
+ __tablename__ = 'bar'
+ id = Column('id', Integer, primary_key=True)
+ foo_id = Column('foo_id', Integer)
+ __mapper_args__ = {'inherit_condition':foo_id==Foo.id}
+
+ # compile succeeds because inherit_condition is honored
+ compile_mappers()
+
def test_joined_inheritance(self):
class Company(Base, ComparableEntity):
__tablename__ = 'companies'