> Now I want to build a query to get all Workstations which are related
> to server 'foo'.
>
> This works:
>
> ws = DBSession.query(WorkStation).select_from(join(WorkStation,
> DHCPServer)).filter(DHCPServer.label == 'foo').all()
>
> but It's too complex. Is there an easier way?
>
> Something like:
> DBSession.query(WorkStation).filter(Workstation.server.label ==
> 'foo').all()
>
> Thanks!
>
>
ws =
DBSession.query(WorkStation,DHCPServer).join(DHCPServer).filter(DHCPServer.label
== 'foo')

Should give the same result. You shouldn't need a select_from() for a simple
query like this when all the join conditions are obvious.

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