Skip to main content

Update ZODB class references for moved or renamed classes.

Project description

This package provides a tool that automatically identifies and updates references from persistent objects to classes that are in the process of being moved from one module to another and/or being renamed.

If a class is being moved or renamed, you need to update all references from your database to the new name before finally deleting the old code.

This tool looks through all current objects of your database, identifies moved/renamed classes and touches objects accordingly. It creates a single transaction that contains the update of your database.

Having run this tool, you are then free to delete the old code.


Installing the egg of this tool provides a console script zodbupdate which you can call giving either a FileStorage filename or a configuration file defining a storage:

$ zodbupdate -f Data.fs
$ zodbupdate -c zodb.conf

Detailed usage information is available:

$ zodbupdate -h

Custom software/eggs

It is important to install this egg in an interpreter/environment where your software is installed as well. If you’re using a regular Python installation or virtualenv, just installing the package using easy_install should be fine.

If you are using buildout, installing can be done using the egg recipe with this configuration:

parts += zodbupdate

recipe = zc.recipe.egg
eggs = zodbupdate
    <list additional eggs here>

If you do not install zodbupdate together with the necessary software it will report missing classes and not touch your database.

Non-FileStorage configurations

You can configure any storage known to your ZODB installation by providing a ZConfig configuration file (similar to zope.conf). For example you can connect to a ZEO server by providing a config file zeo.conf:

    storage 1

And then running zodbupdate using:

$ zodbupdate -c zeo.conf

Pre-defined rename rules

Rename rules can be defined using entry points:

      entry_points = """
      renames = mypackage.mymodule:rename_dict

Rename rules are dictionaries that map old class names to new class names:

renames = {'mypackage.mymodule ClassName':
           'otherpackage.othermodule OtherClass'}


0.2 (2009-06-23)

  • Add option to store the rename rules into a file.

  • Don’t commit transactions that have no changes.

  • Load rename rules from entry points zodbupdate.

  • Compatibility with Python 2.4

  • Rename from zodbupgrade to zodbupdate.

  • Add ‘verbose’ option.

  • Improve logging.

  • Suppress duplicate log messages (e.g. if the same class is missing in multiple objects).

  • Improve the updating process: rewrite pickle opcodes instead of blindly touching a class. This also allows updating pickles that can’t be unpickled due to missing classes.

0.1 (2009-06-08)

  • First release.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zodbupdate-0.2.tar.gz (11.6 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page