- Fix error message referencing old @classproperty
name to reference @declared_attr [ticket:2061]
+ - Arguments in __mapper_args__ that aren't "hashable"
+ aren't mistaken for always-hashable, possibly-column
+ arguments. [ticket:2091]
+
0.6.6
=====
- orm
class MyMixin(object):
a = Column(Integer)
b = Column(Integer)
-
+
@declared_attr
def __table_args__(cls):
return (Index('test_idx_%s' % cls.__tablename__, 'a', 'b'),)
# make sure that column copies are used rather
# than the original columns from any mixins
- for k, v in mapper_args.iteritems():
- mapper_args[k] = column_copies.get(v,v)
-
+ for k in ('version_id_col', 'polymorphic_on',):
+ if k in mapper_args:
+ v = mapper_args[k]
+ mapper_args[k] = column_copies.get(v,v)
if classname in cls._decl_class_registry:
util.warn("The classname %r is already in the registry of this"
# change this ordering when we do [ticket:1892]
our_stuff[k] = p.columns + [col]
+
cls.__mapper__ = mapper_cls(cls,
table,
properties=our_stuff,
assert 'inherits' not in Person.__mapper_args__
assert class_mapper(Engineer).polymorphic_identity is None
assert class_mapper(Engineer).polymorphic_on is Person.__table__.c.type
+
+ def test_we_must_only_copy_column_mapper_args(self):
+ class Person(Base):
+
+ __tablename__ = 'people'
+ id = Column(Integer, primary_key=True)
+ a=Column(Integer)
+ b=Column(Integer)
+ c=Column(Integer)
+ d=Column(Integer)
+ discriminator = Column('type', String(50))
+ __mapper_args__ = {'polymorphic_on': discriminator,
+ 'polymorphic_identity': 'person',
+ 'version_id_col': 'a',
+ 'column_prefix': 'bar',
+ 'include_properties': ['id', 'a', 'b'],
+ }
+ assert class_mapper(Person).version_id_col == 'a'
+ assert class_mapper(Person).include_properties == set(['id', 'a', 'b'])
+
+
def test_custom_join_condition(self):
class Foo(Base):