Hello everyone,

So I've got this piece of code:

selectexpr = session.query(Host, Architecture, OS_Kind)

selectexpr = 
selectexpr.filter(Host.Architecture_id==Architecture.id).filter(Architecture.Architecture=='IBM
 
xSeries')

selectexpr = 
selectexpr.filter(Host.OS_Kind_id==OS_Kind.id).filter(OS_Kind.OS_Kind=='Linux')

selectexpr = selectexpr.filter_by(Up_n_running = True).order_by(field)


Now, this works. The reason I'm doing it not in one piece (i.e. not in 
one big expression) is primarily because some expressions in the final 
app will be optional, i.e. the user may or may not filter by 
Architecture and may or may not filter by OS_Kind.

This also works:

selectexpr = 
session.query(Host).select_from(join(Host,OS_Kind)).filter(OS_Kind.OS_Kind 
=='Linux').filter_by(Up_n_running = True).order_by(field)

Is there some way in sqa to join on 3 tables (like in the 1st piece of 
code above) or more?

To tell the truth, I'm not all that fluent in SQL per se, so I have 
trouble working out the solution..

Regards,
Marcin Krol

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