On Wed, 2009-01-14 at 16:18 -0700, Alex Richardson wrote: > On Wed, Jan 14, 2009 at 3:56 PM, Gordon Allott <[email protected]> wrote: > Gordon, > > There are two different topics that I think your posting touches on. > > First is the question of who to use a join in a query. The tutorial > code you refer to properly demonstrates this. And it sounds like you > don't have any trouble getting the table join to work. > > The second question is how to build a 'where' clause to select the > appropriate rows. In the simple example above, you could use the > following code to find the companies for Ben, Steve, and Jon: > > origin = [Company, Join(Employee, Employee.company_id == Company.id)] > result = store.using(*origin).find(Company, > (Employee.name.like(u"Ben%") | (Employee.name.like(u"Ben%") | > (Employee.name.like(u"Ben%") ) ) > > Note that the pipe operator '|' is shorthand for the more > verbose/explicit use of the 'Or' method. > > result = store.using(*origin).find(Company, > Or(Employee.name.like(u"Ben%"), (Employee.name.like(u"Ben%"), > (Employee.name.like(u"Ben%") ) ) > > The use of 'and', 'or' and 'in', to build more complex where clauses > is touched upon in the storm manual. > (https://storm.canonical.com/Manual) > > Alex Richardson
yes, but this method seems not to work, At the moment I am building up a list that looks similar to: (like is not actually needed in my situation) employees = [Employee.name == u'Ben', Employee.name == u'Steeve', Employee.name == u'John'] neither of the following work: store.using(*origin).find(Company, *employees) store.using(*origin).find(Company, And(employees)) although the following does: store.using(*origin).find(Company, Employee.name == u'Ben') # u'Steeve' and u'John' would work on their own also. -- Gordon Allott ([email protected])
signature.asc
Description: This is a digitally signed message part
-- storm mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm
