I have a query which selects an entity A and some calculated fields q = session.query(Recipe,func.avg(Recipe.somefield).join(.....)
I then use what I select in a way which assumes I can subscript result with "Recipe" string: for entry in q.all(): recipe=entry.Recipe # Access KeyedTuple by Recipe attribute ... Now I need to wrap my query in an additional select, say to filter by calculated field AVG: q=q.subquery(); q= session.query(q).filter(q.c.avg_1 > 1) And now I cannot access entry.Recipe anymore! Is there a way to *make* SQLAlchemy adapt a query to an enclosing one, like aliased(adapt_on_names=True) or select_from_entity()? I tried using those but was given an error -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.