Actually not quite. The code bellow executes, however it doesn't produce 
a where clause for the filter_by(). I don't know if this is a bug or 
user error.
What ended up working for me was this:
    statement = 
qstat_table.outerjoin(chunk_table).select(use_labels=True, 
whereclause=where_clause).order_by(JobInfo.c.job_name, 
Chunk.c.pass_field, JobInfo.c.owner)
    query = session.query(JobInfo).options(contains_eager('Chunk'))
    r = query.from_statement(statement).all()

David Gardner wrote:
> Thats it, I just need to use from_statement. OK this works producing
> good SQL:
>
>     statement =
> qstat_table.outerjoin(chunk_table).select(use_labels=True).order_by(JobInfo.c.job_name,
> Chunk.c.pass_field, JobInfo.c.owner)
>     query =
> session.query(JobInfo).options(contains_eager('Chunk')).filter_by(**kwargs)
>     r = query.from_statement(statement).all()
>
>   

-- 
David Gardner
Pipeline Tools Programmer, "Sid the Science Kid"
Jim Henson Creature Shop
(323) 802-1717 [EMAIL PROTECTED]



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to