I don\'t have much experience with SQLAlchemy and I have a problem, which I can\'t solve. I tried searching and I tried a lot of code. This is my Class (reduced to the most
I used it with sessions, but an alternate way where you can access the relationship field directly is
db_session.query(Patient).join(Patient.mother) \
.filter(Patient.mother.property.mapper.class_.phenoscore==10)
I have not tested it, but I guess this would also work
Patient.query.join(Patient.mother) \
.filter(Patient.mother.property.mapper.class_.phenoscore==10)