I seem to have solved it by aliasing the first instance too query = sqlalchemy.orm.query(Xxx) *alias = SA.orm.aliased(Xxx)* query = query.join(*(alias,'parent')*, aliased=True) query = query.filter(<some criterion>)
But this basically succeeded "by magic" when I just tried all sorts of stuff. I can't really understand why an addition of an alias caused the SQL not have an additional alias. Is there a place in the doc that explains this? I don't feel safe with these "magical" solutions, they tend to break on SA upgrades. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/Uv0aBPk1sS4J. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.