Skip navigation links

MySQL Forums :: SQLite :: SQLite Migration


Advanced Search

SQLite Migration - Converter tools
Posted by: alexey petrovsky ()
Date: May 28, 2006 01:36AM

http://www.sqlite.org/cvstrac/wiki?p=ConverterTools

Please, read the possible solutions on SQLite CVSTrack. It depends in what direction you need to migrate: Sqlite -> Mysql or Mysql -> Sqlite.

I find it interesting to migrate to Sqlite, because overall performance of data analysis is faster in SQLite from 2.5x to 20x (and some queries in MySQL still can't be performed likt nested selects with limit clause).

You may need to correct your table schema. Here we go:


* MySQL to SQLite3 (shell script)

A quick way to convert a MySQL DB to SQLite3 is the following shell script (it does not claim to be complete):

#!/bin/sh

mysqldump --compact --compatible=ansi --default-character-set=binary mydbname |
grep -v ' KEY "' |
grep -v ' UNIQUE KEY "' |
perl -e 'local $/;$_=<>;s/,\n\)/\n\)/gs;print "begin;\n";print;print "commit;\n"' |
perl -pe '
if (/^(INSERT.+?)\(/) {
$a=$1;
s/\\'\''/'\'\''/g;
s/\\n/\n/g;
s/\),\(/\);\n$a\(/g;
}
' |
sqlite3 output.db



Edited 1 time(s). Last edit at 05/28/2006 01:39AM by alexey petrovsky.

Options: ReplyQuote


Subject Views Written By Posted
SQLite Migration 15807 Laurent Goussard 02/06/2006 12:12PM
SQLite Migration - Converter tools 120078 alexey petrovsky 05/28/2006 01:36AM
Re: SQLite Migration - Converter tools 19607 martinezfive 05/31/2006 06:32PM
SQLite Migration - Converter tools: SQlite -> MySQL 27733 alexey petrovsky 06/04/2006 12:44PM
Re: SQLite Migration - Converter tools: SQlite -> MySQL 11775 Joan Cruz 04/03/2009 03:12AM
Re: SQLite Migration - Converter tools 10991 max page 06/03/2009 07:58AM
Re: SQLite Migration 8423 Dmitry Narizhnykh 02/13/2009 06:29PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.