sqlalchemy: 'InstrumentedList' object has no attribute 'filter'

前端 未结 1 1813
迷失自我
迷失自我 2020-12-05 22:57

I have the following 3 classes:

class Resource:
    id = Column(Integer, primary_key=True)
    path = Column(Text)
    data = Column(Binary)
    type = Colum         


        
相关标签:
1条回答
  • 2020-12-05 23:47

    In order to work with the relationship as with Query, you need to configure it with lazy='dynamic'. See more on this in Dynamic Relationship Loaders:

    _resources = relationship("EnvironmentResource",
        cascade="all, delete-orphan",
        lazy='dynamic',
        passive_deletes=True)
    
    0 讨论(0)
提交回复
热议问题