[ZODB-Dev] Advice On ZODB
Bill Anderson
bill@libc.org
24 Jan 2003 08:44:42 -0700
On Fri, 2003-01-24 at 08:38, Christian Reis wrote:
> On Fri, Jan 24, 2003 at 10:19:12AM -0500, Chris McDonough wrote:
> > http://www.zope.org/Members/mcdonc/HowTos/gainenlightenment
> >
> > ZODB is not table-driven like a relational database. It's an object
> > database, so you should try to create objects that represent your
> > problem domain and store them in ZODB. So for instance if the data
> > you're trying to store is information about internet hosts, you might
> > have a Host class:
>
> [snip]
>
> > root['host1'] = Host('192.168.0.1')
> > root['host2'] = Host('192.168.0.2')
>
> Sure, but now let's assume he wants to query all hosts by IP block,
> hostname or CIDR, then what? :-) A catalog is a very relevant issue for
> people keeping collections of objects, specially if you have more than
> one kind and the root feels cramped.
Two options (probably more, these are the first two that come to my
mind):
1. Use ZCatalog to index the properties
2. An additional container object that has the functionality built into
it to such as: containerobject.getAllHostNames()