Please help me with exporting a MySQL database into a SQLite database.
Personally I like the simple usage of mysqldump, yet some adjustments are need (depending on your art with Unix and what you want to do).
Ex. for just one table (prods) with PK:
$ mysqldump mysql prods -u ME -pPASS --compatible ansi --compact |grep -v "^\/\*" |sqlite3 testme2.db
$ mysqldump mysql prods -u ME -pPASS --compatible ansi --compact |grep -v "^\/\*" |sqlite3 testme2.db
Error: near line 1: table "prods" already exists
Error: near line 7: UNIQUE constraint failed: prods.id, prods.ts
$ sqlite3 testme2.db '.schema'
CREATE TABLE "prods" (
"id" varchar(30) NOT NULL DEFAULT '',
"ts" int(11) NOT NULL DEFAULT '0',
"val" double DEFAULT NULL,
PRIMARY KEY ("id","ts")
);
For more complex things, probably better to write a wrapper, or then, use the already mentioned fantastic awk Linux shell script on Gist .