[ZODB-Dev] Packing a stand alone ZODB

Tim Peters tim at zope.com
Tue Jul 27 16:25:47 EDT 2004


[Chris Cioffi]
> Hello all, silly question but I can't find this on the wiki or through
> google:  How does one pack a stand alone ZODB?

Not silly at all -- I'm not sure it's written down anywhere!  You could
deduce it from staring at the ZODB test suite, but that's about it.

Here using ZODB 3.2.2:

>>> import ZODB
>>> from ZODB.FileStorage import FileStorage
>>> st = FileStorage('Data.fs')
>>> db = ZODB.DB(st)
>>> print db.pack.__doc__
None
>>> db.pack()
>>> db.close()
>>>

Alas, the docstring is empty.  Here's the DB.pack() docstring from ZODB 3.3:

    def pack(self, t=None, days=0):
        """Pack the storage, deleting unused object revisions.

        A pack is always performed relative to a particular time, by
        default the current time.  All object revisions that are not
        reachable as of the pack time are deleted from the storage.

        The cost of this operation varies by storage, but it is
        usually an expensive operation.

        There are two optional arguments that can be used to set the
        pack time: t, pack time in seconds since the epcoh, and days,
        the number of days to subtract from t or from the current
        time if t is not specified.
        """

I recommend days=1.

> On a possibly related

Nope <wink>.

> note, where are the tools mentioned at
>
http://zope.org/Members/adytumsolutions/HowToLoveZODB_PartI/HowToLoveZODB_Pa
rtV ?
>  The Windows install doesn't include them.

I didn't even know some of those existed.  If want all of them, you'll
probably need to download the source distribution.  The important tools
explained here:

    http://zope.org/Wikis/ZODB/FileStorageBackup

are installed by the Windows installer, but there isn't an obvious place to
install things on Windows.  They end up in a directory named Scripts
immediately under your Python installation:

C:\Python23\Scripts>dir/b *.py
fsdump.py
fsrefs.py
fstail.py
fstest.py
mkzeoinst.py
repozo.py
runzeo.py
zdctl.py
zdrun.py
zeopack.py

Those are just the scripts installed by ZODB.  You may find other things in
there; all distutils-based Windows installers put scripts in this directory.
The definition of what "a script" is is inherited from the Unix setup,
though, and not all useful tools are identified "as scripts" on Unix.  Those
that aren't don't get included in the Windows installer as a result, and
you'll need to download the source tarball if you want them.



More information about the ZODB-Dev mailing list