Some of the information here may be outdated, please check the book instead

In web2py you can backup/restore an entire database, across database engine, from the shell with two command:

  • have a model that connects to the sqliite db
  • run

    python web2py -S yourapp -M

  • in the shell type


  • quit, edit the model to connect to the other db instead

  • from the shell type

    python web2py -S yourapp -M

  • in the shell type


Done. Id's may be different but references will be preserved and will not be broken.

Requires web2py 1.64.4

Caveats and UUID

When importing the new records will be appended to the database if this is not empty. If a table contains a field called "uuid", this field will be used to identify duplicates and an imported record has the same "uuid" as an existing record the previous record is updated.

© 2008-2010 by Massimo Di Pierro - All rights reserved - Powered by web2py - design derived from a theme by the earlybird
The content of this book is released under the Artistic License 2.0 - Modified content cannot be reproduced.