I saw that, but I'm not using a subquery in the from clause. Maybe I wasn't clear enough. Example:
outeruser = aliased(User)
inneruser = aliased(User)
innerselect = session.query(
inneruser.id).filter(
inneruser.id ==
outeruser.id).subquery()
At this point I already have a problem, the generated from clause is something like:
from user as user_2, user as user_1
I didnt want the other user_2, because the filter statement is actually referencing the user of the outerselect:
outerselect = session.query(outeruser).filter(
outeruser.id == innerselect)
I expected that the innerselect referenced the id of the outer select.
(That example was really a useless scenario, I'll try to make a better one later)