[ZODB-Dev] Relational queries on zope obj db?

Chris McDonough chrism@digicool.com
Mon, 28 May 2001 23:41:18 -0400


Hi Jeff,

You may want to look at ZCatalog.  ZCatalog is not very good at ad-hoc
queries... you generally need to know what you're going to want to ask
it and set up indexes appropriately beforehand.  In this way, it's
inferior to SQL and may be inappropriate for your application.  OTOH, it
can do full-text searching easily (which is problematic in many
relational databases), and it's quite fast query-wise.

A bit of Python to handle your example using your example is (assuming a
more OO arrangement of instances):

for customer in Catalog.searchResults(meta_type='Customer', id='A'):
    results = {}
    orders = customer.purchaseOrders()
    for order in orders:
        line_items = order.items()
        results[order] = line_items
    return results

- C


Jeff Kowalczyk wrote:
> 
> I'm very interested in using zope, but before I dive in, I have a
> fundamental question that always presents itself when looking at object
> database technologies.
> 
> How does a zope developer select related items across folders from the
> object store? In effect, I'm asking what ZopeDB can do to feign
> relational SQL when it needs a select query on its objects, more
> extensive than a simple knock-out filter.
> 
> The stumbling block is always the same:
> The problem domain may model perfectly in an ODB's folders/forms, but
> then the customer asks for the kind of report that would be a snap in
> SQL with any relational database, but is very difficult, or horrendously
> slow to do in the object database.
> 
> A simple example would be: customer-class in one folder,
> purchaseorder-class in another, productitem-class in a third; select all
> purchase orders for customerA, displaying each individual productitem
> ordered.
> 
> Thanks! If there's any way to do SQL-like queries against Zope's Object
> Database, or to arrive at the same result, I'm going to check out Zope
> very seriously.
> 
> _______________________________________________
> For more information about ZODB, see the ZODB Wiki:
> http://www.zope.org/Wikis/ZODB/
> 
> ZODB-Dev mailing list  -  ZODB-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zodb-dev