From:       To:      

Home > Documentation > SQLite to PostgreSQL

Command Line Version of SQLite to PostgreSQL Converter

To perform batch conversion or call conversion procedure from an automation script you can use console version of SQLite to PostgreSQL converter called L2PAGENT.EXE. Find this file in the installation folder. You can either run this tool directly from command line or call it from any script as well. The program supports the following command-line options:

--case_sens   make names case sensitive (default is off)
--dest=...   PostgreSQL database or dump file name
--dump   convert SQLite database into PostgreSQL script file
--encoding=...   PostgreSQL character set
--help   display help message and exit
--host=...   PostgreSQL server IP address or network name
--logfile=...   path to the logfile where execution traces will be written
--mode=...   how to process an existing PostgreSQL database (0 - overwrite the entire database, 1 - overwrite existing tables only, 2 - skip existing tables, 3 - merge, 4 - synchronize)
--port=...   PostgreSQL port
--profile=...   path to a profile to load conversion settings from
--pswd=...   PostgreSQL user password
--silent   use this option to disable program output
--src=...   path to SQLite database
--tab_def   convert table definitions only
--tab_file=...   file containing table names to convert (one table name per line)
--user=...   PostgreSQL user name

In the following example the program converts SQLite database located in "c:\db 1.sqlite" into PostgreSQL database "db 1" on the remote PostgreSQL server "pgshost":

L2PAGENT.EXE --src="c:\db 1.sqlite " --dest="db 1" --host=pgshost --user=postgres 
--pswd=the_passsword

Notes:

  1. You can omit 'host' parameter to connect local PostgreSQL server
  2. It is necessary to specify 'port' parameter only if it differs from the default PostgreSQL port 5432
  3. If you omit 'tab_file' parameter, all database tables will be converted
  4. If you omit 'mode' parameter, default mode 'overwrite the entire database' will be used
  5. Command line parameters that contain spaces should be enclosed in quotes (for example --dest="my database")

PostgreSQL character sets

This parameter specifies encoding of text values in the destination PostgreSQL database. It can have one of the following values (default is 'UTF8'):

BIG5 EUC_CN EUC_JP EUC_KR EUC_TW
GB18030 GBK ISO8859-1 ISO8859-2 ISO8859-3
ISO8859-4 ISO8859-5 ISO8859-6 ISO8859-7 ISO8859-8
ISO8859-9 KOI8R KOI8U SJIS UHC
UTF8 WIN1250 WIN1251 WIN1252 WIN1253
WIN1254 WIN1255 WIN1256 WIN1257 WIN1258

Have any questions? Contact us