From:       To:      

Home > Documentation > SQLite to PostgreSQL

SQLite to PostgreSQL Migration Tutorial

[SQLite to PostgreSQL Converter]  [Command line]

The process of database migration from SQLite to PostgreSQL consists of the following steps:

1. Select Migration Scenario

SQLite to PostgreSQL converter provides two options of migrating databases from SQLite to PostgreSQL:

  • Move to PostgreSQL server directly - use this approach to export the contents of the source database into database on the target PostgreSQL server. You need PostgreSQL server launched and also necessary privileges to write into database on the target server.
  • Export into PostgreSQL script file - the program exports the data into a local script file instead of migrating it to PostgreSQL server. The resulting script contains SQL statements to create all tables and to fill them with the data. See Import PostgreSQL script files article for related information.
    

2. Connect to PostgreSQL

If you selected "Move to PostgreSQL server directly" checkbox on the previous step, provide all necessary information to connect to PostgreSQL server.

By default, the program is trying to connect to local PostgreSQL server. It is indicated by radio button "Local" selected. For remote connection select "Remote" radio button, specify the PostgreSQL host (network name or IP address) and the port (only if it differs from the default 5432).

By default, PostgreSQL server connects to database with name equal to the username specified. If there is no such database or PostgreSQL server does not allows access to it, custom database may be specifies on this wizard page.

    

3. Select Databases

On this step you need to specify SQLite database and PostgreSQL database or script file (depending on the conversion scenario chosen on the first step). Existing PostgreSQL database will be processed as follows:

  • Overwrite the entire database
  • Overwrite existing tables only
  • Skip existing tables
  • Merge
  • Synchronize

Specify log file to enable the program write execution traces. It may be used to analyze possible error messages and get more control over the conversion process. If no log file is specified, the logging is disabled.

    

4. Conversion Settings

Customize the conversion process using the following settings:

  • Convert table definitions only
  • Skip converting indexes

In "PostgreSQL encoding" field you can point the appropriate encoding to interpret migrated data properly.

Finally, you can specify PostgreSQL schema according to one of the following options:

  • Use existing: specify existing schema to import all tables there.
  • Create new: create new schema to import all tables there.
    

5. Select Tables

Select SQLite tables for migration to PostgreSQL. To add new table highlight it in "Available tables" list and click "Add" (or simply double click the item). Click "Add all" to add all tables to migration. To remove an item from "Selected tables" list highlight it and click "Remove" button. Click "Remove all" button to remove all items from "Selected tables" list box.

To edit table double click the corresponding item in "Selected tables" list box. Then the dialog box appears to edit table attributes and to define custom type mapping. See Edit Table article for the further information.

    

Have any questions? Contact us