Chuck Thier just brought a related question in the channel, and I
added another entry to the tutorial:


==== Many objects with one query ====

Sometimes, it may be interesting to retrieve more than one object involved
in a given query.  Imagine, for instance, that besides knowing which
companies have an employee named Ben, we also want to know who is the
employee.  This may be achieved with a query like follows:

{{{#!python
>>> result = store.find((Company, Employee),
...                     Employee.company_id == Company.id,
...                     Employee.name.like(u"Ben %"))

>>> [(company.name, employee.name) for (company, employee) in result]
[(u'Sweets Inc.', u'Ben Bill')]

}}}


-- 
Gustavo Niemeyer
http://niemeyer.net

-- 
storm mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/storm

Reply via email to