自定义映射hybrid_property

时间:2017-05-23 21:11:28

标签: sqlalchemy

我遇到了使用hybrid_property配置映射器模型的问题 如何正确配置hybrid_property

class FooTable:
    __tablename__ = 'foo'
    name_translations = Column(JSONB, nullable=False)
    name = hybrid_property(...)

class Foo:
    def __init__(self, name_translations):
        self.name_translations = name_translations

# columns = [name_translations]
attributes = tuple(columns) + FooTable.__table_args__
table = Table(FooTable.__tablename__, metadata, *attributes)
mapper(Foo, table, properties=**HOW???**)

感谢您的帮助。

0 个答案:

没有答案