I am using SQLAlchemy with Flask to create relationships for my application. I recently rewrote the relationships, and, no matter what I change, I keep getting the error:
Try to use primaryjoin in your CurriculumVersion class as follows:
Change
enrollments = db.relationship('Enrollment', backref='enrollment', lazy='dynamic')
to
enrollments = db.relationship('Enrollment', backref='enrollment', lazy='dynamic', primaryjoin="Enrollment.version_id==CurriculumVersion.id")
Note: You might need to do this for the other classes as well.