Cloning SQLlite db into PostgreSQL

420 views
Skip to first unread message

Alan Etkin

unread,
Jan 18, 2013, 12:03:48 PM1/18/13
to web2py-d...@googlegroups.com
I've modified an original script by Mariano to migrate data from sqlite to pg. This tool can be very useful when users want to deploy a db with postgres but have been usign the default SQLite connection for development.

Migrating data from a sqlite is becoming a common issue https://groups.google.com/forum/?fromgroups=#!topic/web2py/B3eLkJaQvEg

The reason to choose using this over using the csv import/export builtin features is that it preserves id numbers (currently, import_from_csv does not preserve ids for postgres, AFAIK). It needs more tests and perhaps using bulk insert instead of individual record insertion, but it worked with a small example db and should also work in general.

I attached the module in case anybody wants to try it. See the module docstring for instructions.
sqlite2pg.py

Karthick GRK

unread,
May 19, 2016, 8:10:13 AM5/19/16
to web2py-developers
Though the migrate method  executed successfully I can only see empty postgres database.
Reply all
Reply to author
Forward
0 new messages