[ZODB-Dev] Tool for exploring raw ZODB data

Jeff Sasmor jsasmor@gte.net
Sun, 16 Feb 2003 15:36:18 -0500


>AFAICT the ZODB has no concept of `folders', does it? I thought folders
>and paths were just a semantic given by us to hierarchies of
>PersistentMappings. At least I see no reference to `folders' in the ZODB
>source code.


Perhaps I should say 'container'. An empty (new)
ZODB data.fs is comprised of a persistent mapping,
that's the so-called root object. If what you add to it
is any sort of an object that's an instance of a class, 
at least a 'classic' class, then that object has a 
dictionary in it and is in that sense also a 
container (aka folder).  

If what you put into the 'root' is a tuple, then
a tuple has no dict and that's all there is to it.

Zope, for example, uses a folder object that acts
as a container for subobjects which themselves can
be folders. So I guess that's where my use of the
term Folder comes from. You're right that the
ZODB has no concept of folders. You can use the
code I wrote to traverse thru instances of classic
classes and do some customization to examine other types
of objs if one wanted to.

>So how does the path mechanism work? It tries to index the
>PersistentMapping by using the string as a keys?

Yes. If you think of a set of nested classic class instances as
object1.object2.object3 then the path would be 
object1+object2+object3. If you have a debugger try to
see what happens using a Zope data.fs - it's interesting
and there's an example on the website.

The way I am using the ZODB I impress a folderish
heirarchy on it (along with a wxWindows GUI) as
a development system for Python. Among other types
of objects you can create are PythonModules. These
have the source and also compiled code stored in the ZODB.
When I launch an app, I want to be able to get at the code
obj when an import happens. But I don't want to have the
overhead and speed hit of recreating the object - I 
don't need it and don't want it. I just want to get at 
a few of the attributes. 

That's the reason for writing this code. I can open the
ZODB in read-only mode, get the code and do the
import quickly.

I still think it's cool to be able to examine the ZODB
at this low a level...

#--------------------------------
Jeff Sasmor
jeff@sasmor.com
----- Original Message ----- 
From: "Christian Reis" <kiko@async.com.br>
To: "Jeff Sasmor" <jsasmor@gte.net>
Cc: <zodb-dev@zope.org>
Sent: Saturday, February 15, 2003 9:36 PM
Subject: Re: [ZODB-Dev] Tool for exploring raw ZODB data


On Sat, Feb 15, 2003 at 08:12:38PM -0500, Jeff Sasmor wrote:
> Your ZODB app probably isn't heirarchically saving
> things in the ZODB - no folder/subobject heirarchy. I

Hmm, is this where the assumption I suspected is made? :-) 

AFAICT the ZODB has no concept of `folders', does it? I thought folders
and paths were just a semantic given by us to hierarchies of
PersistentMappings. At least I see no reference to `folders' in the ZODB
source code.

So how does the path mechanism work? It tries to index the
PersistentMapping by using the string as a keys?

Sorry if *I'm* confused - it's just that I have no clear idea of what
folders are, and I've actually used quite a bit of the ZODB.

> made a minor change in the printing code so that
> if what's returned isn't a dict it will just print it 
> letting Python figure out the best way to print.

Did you see my change I sent you? It does exactly that, but using
pprint. I also shortcut some of the loops to avoid nesting.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL

_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev