*** 47,49 **** --- 47,73 ---- *: {link: http://www.kexi-project.org/ Kexi} _: Kexi (Open Source MS Access competitor) is able to import/export database schemas between SQLite format (which is Kexi's native format) and server engines (MySQL, PostgreSQL) and MS Access (using MDB Tools). User-friendly wizards are prepared. Importing tables with CSV format is also available with a nice GUI. + + *: PostgreSQL to SQLite3 + + _: After a little experimenting, I found a way to import data from PostgreSQL into SQLite, version 3, without having non-ASCII characters ruin things (something that getting pg_dump to export SQL statements did...). It could be enormously improved with a little scripting love, but as I only had one database with a couple of big tables to deal the below was fine, however... post improvements! + + Export the data from your database as tab delimited text. Create one text file for every table in your database: + + $ pg_dump -a <dbname> -t <tablename> > /tmp/<dumpfile> + ...and so on... + + Trim off crap from header and footer from each file, eg: + + $ nano -w /tmp/<dumpfile> + + If required, create SQLite file and tables corresponding to tables in the original PostgreSQL database: + + $ sqlite3 <dbname> + sqlite> CREATE TABLE ...etc... + + Finally, import the dump files into SQLite, remembering to change the default import separator to a <tab>: + + $ sqlite3 <dbname> + sqlite> .separator "\t" + sqlite> .import <dumpfile> <tablename>