q = session.query(Recipe, func.avg(Recipe.field1).over(...)).join(...)

I have a query which selects some mapped entity as well as other columns.

I then refer to the name of that entity when working with the result of the 
query:
for entry in q.all():
   recipe=entry.Recipe
   ....

Now, I want to add filtering by some calculated criteria to my query, and 
so I wrap it in an additional query:
q = q.subquery();
q = session.query(q).filter(q.c.avg_1 > 10 )

However, this way I can no longer access entry.Recipe! Is there a way to 
make sqlalchemy adapt names? I tried aliased and select_entity_from, but no 
luck :(

-- 
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.

Reply via email to