Transferring data between sqlite databases Transferring data between sqlite databases linux linux

Transferring data between sqlite databases


SQLite is compatible with both Windows and Linux platforms.

The database file format is cross-platform - you can freely copy a database between 32-bit and 64-bit systems or between big-endian and little-endian architectures. These features make SQLite a popular choice as an Application File Format.

Source: http://sqlite.org/about.html


As Robert writes, SQLite files should work on any platform. If you decide to switch to MySQL or PostgreSql you can run the following (standard) command to save your database on the Windows machine:

manage.py dumpdata <app1> <app1> > mydbdump.json

and then configure the settings.py on the Linux machine for the MySQL or PostgreSql database and run:

manage.py syncdbmanage.py loaddata ./mydbdump.json

I have successfuly done this on several occasions to switch from MySQL to SQLite it worked fine.

Just for reference, you can omit the listing in the dumpdata command to dump data for all installed apps but it will not be possible to load it back in. The all-inclusive dump will contain some internal Django records such as default content types and user authentication which are also created by the syncdb command. So you get errors like

IntegrityError: columns app_label, model are not unique

List the specific apps that you want to dump and load and it will work.