同义词不触发SQLAlchemy验证器方法

时间:2014-05-11 21:02:10

标签: python validation sqlalchemy

我在连接表继承中有一些表,子类有父列的同义词属性:

class Parent(DeclarativeBase):
    # ...
    parent_column = Column(String(255))

class Child(Parent):
    # ...
    child_column = synonym('parent_column')

    @validates('child_column')  # @validates('parent_column') also does not work
    def validator(self, name, value):
        # not called at all
        raise ValueError()

我错过了什么?这目前不可能吗?

1 个答案:

答案 0 :(得分:1)

目前这是SQLAlchemy的限制,请参阅bug:#2943