Recently I had a fairly complex SQL query I wanted to write out using 
SQLAlchemy.
I ended up implementing it using select() so what I end up doing looks 
something like:

parent=my_table.alias('parent')
child=my_table.alias('child')
j=parent.outerjoin(child, <condition>)
my_qry=select([my_table], from_obj[j])

Then later on I do:
session.query(MyObj).from_statement(my_qry.where(parent.c.foo==bar)).all()

Is there any reason why I shouldn't just keep my_qry instantiated and 
use it as needed, or should I re-construct it for each query?

-- 
David Gardner
Pipeline Tools Programmer, "Sid the Science Kid"
Jim Henson Creature Shop
dgard...@creatureshop.com



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to