[ZODB-Dev] Sample applications?
Christian Robottom Reis
kiko@async.com.br
Tue, 9 Oct 2001 02:33:34 -0300 (BRT)
On Mon, 8 Oct 2001, Patrick K. O'Brien wrote:
> I started working on a sample application over the weekend, called
> NoteKeeper. At this point I'm mostly just playing around with different
Will check it out.
> FolderManager is a class that has a property that is an IOBTree where new
> folders are stored.
Well, I find that a bit complex. I just have a string that indexes the
root object that identifies a Catalog - "SalesCatalog", for instance.
Avoids the exec/compile. If that's a common solution, I know not, but it
WFM(tm).
> I don't want to make this message much longer, but I would like to hear from
> anyone who has an opinion about how to structure root elements. Especially,
> what to use as the key for Btrees, and why. (I have spent years doing
> relational databases and am having a hard time going from
> tables/views/queries to object collections.) Any help would be appreciated.
Usually, I keep BTrees indexed by an ID that I generate myself when adding
to the hash.
I come from the same (sorry) background. I tend to keep shallow
hierarchies - all my catalogs are stuck onto the root object. I made some
convenience functions like get_catalog() and so on in the tradition of
get_transaction(). Examples:
# init catalog
root["SalesCatalog"] = BTrees.IOBTree.IOBTree()
# query stuff
c = get_catalog("SalesCatalog")
c.query("product","noogie")
And so forth. See the StandalonePOS src for details.
Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL