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)