Dear list...

Actually I'm trying something rather simple so I'm surprised myself that
it got me stuck. Bear with me that I'm not providing much code but the
application is not written in english so the database models aren't
either.

Basically I have three tables like 'companies', 'departments' and
'employees'. I have already set up foreign keys and gave all of them
one-to-many relationships. So a company has several departments. And
each department has several employees. So for an ORM-mapped company
object "mycompany" I can get the departments by the property
"mycompany.departments". Works well.

Now I'd like to create a query for all employees of a certain company. 
And I'm not sure how to properly define a mapper relation propery that
would give me that. Like "mycompany.employees". Do I have to use JOINs
myself in the mapper?

In my application I'd then like to query like this:
    Session.query(Employee).filter_by(employee.company=my_company)

Thanks for any hints.

 Christoph
-- 
[EMAIL PROTECTED]  www.workaround.org   JID: [EMAIL PROTECTED]
gpg key: 79CC6586         fingerprint: 9B26F48E6F2B0A3F7E33E6B7095E77C579CC6586

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to