You can make a Python dump of your database using the dump2py management command that comes with Lino.

For example:

$ python dump2py 20130117

This will create a directory 20130117 with a set of ` .py` files which are a perfect representation, in Python, of your database at that moment. These files contain a complete backup of your database. You can archive the directory and send it around per email.

To restore such a dump to your database, simply run the script from that directory:

$ python run mydump/

Or, if you don't use per-project files:

$ run mydump/

Note that we are using here the run management command. This makes it possible to restore your data into another project, creating a copy of your database.

Note about django-extensions

django-extensions has a command "dumpscript" which is comparable to dump2py.

The most important different is that the Python code generated by dump2py is designed in order to make it possible to write automated database migrations.

Models that get special handling

  • ContentType objects aren't stored in a dump because they can always be recreated.

  • Site and Permission objects must be stored and must not be re-created

  • Session objects can get lost in a dump and are not stored.