I have the following 3 classes:
class Resource: id = Column(Integer, primary_key=True) path = Column(Text) data = Column(Binary) type = Colum
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:
Query
lazy='dynamic'
_resources = relationship("EnvironmentResource", cascade="all, delete-orphan", lazy='dynamic', passive_deletes=True)