As the error message tells you, you need to use in_ instead of foreign keys:
User.query.join(User.person).filter(Person.id.in_(p.id for p in people)).all()
Since you are going to request both in any case, it might be better to do a joint download and then get people to use Python:
people = Person.query.join(Person.user).options(db.contains_eager(Person.user)).limit(3).all() users = [p.user for p in people]
source share