Martijn Faassen wrote: > Missing powerful query concepts > ------------------------------- > > Certain powerful query concepts like joins, available in a relational > setting, are missing. I've already run into a scenario where I wanted to > someting like this: given a bunch of version objects with field 'id', > where multiple objects can have the same 'id' to indicate they're > versions of the same object, I want all objects where field > 'workflow_state' is 'PUBLISHED' unless there is another object with the > same id that have workflow_state 'NEW', in which case I want that one'. > > I think joins would be a way to solve it, though I haven't figured out > the details, nor how to implement them efficiently on top of the > catalog. This kind of thing is where a relational database makes life a > lot simpler.
I used to have the same complaints in Zope 2, but so far I've been happy with Dieter's AdvancedQuery product. See http://www.dieter.handshake.de/pyprojects/zope/AdvancedQuery.html It might be worth a look while thinking about what to implement for zope 3. Here's Dieter's example from that page: from Products.AdvancedQuery import Eq, Between, Le # search for objects below 'a/b/c' with ids between 'a' and 'z~' query = Eq('path','a/b/c') & Between('id', 'a', 'z~') # evaluate and sort descending by 'modified' and ascending by 'Creator' context.Catalog.evalAdvancedQuery(query, (('modified','desc'), 'Creator',)) # search 'News' not yet archived and 'File's not yet expired. now = context.ZopeTime() query = Eq('portal_type', 'News') & ~ Le('ArchivalDate', now) | Eq('portal_type', 'File') & ~ Le('expires', now) context.Catalog.evalAdvancedQuery(query) _______________________________________________ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com