Flame alert: the Plone Python 3 upgrade story

If you plan to convert a RelStorage from Python 2 to 3, prepare a DB configuration snippet like so (this one is meant to be used in my collective.recipe.template section):

%import relstorage
<relstorage>
    blob-dir ${:blobstorage}
    keep-history ${:history}
    <postgresql>
        dsn dbname='${:dbname}' host='${:dbhost}' user='${:dbuser}' password='${:dbpassword}'
    </postgresql>
</relstorage>
  • Pack your DB in Python 2, then immediatly stop the instance.
  • Run buildout with Python 3, but never start the instance.
  • Then run
    ./bin/zodbupdate --pack --convert-py3 --encoding utf8 -c relstorage.cfg
    

That's it.

4 Likes