Assuming postgres can load SQL from a file you should be able to use named pipes on all 3. Here's windows: sqlite> create table t (i integer); sqlite> insert into t values(1); sqlite> insert into t values(2); sqlite> .output \\.\pipe\foo sqlite> .dump 2nd window: sqlite> .read \\.\pipe\foo sqlite> .dump PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; CREATE TABLE t (i integer); INSERT INTO "t" VALUES(1); INSERT INTO "t" VALUES(2); COMMIT; OSX and LInux named pipes are probably more familair to people just using "mkfifo". http://www.macosxhints.com/article.php?story=20041025103920992 so: mkfifo foo sqlite> create table t (i integer); sqlite> insert into t values(1); sqlite> insert into t values(2); sqlite> .output foo <file://\\.\pipe\foo> sqlite> .dump 2nd window: sqlite> .read foo <file://\\foo>
Michael D. Black Senior Scientist Northrop Grumman Mission Systems ________________________________ From: sqlite-users-boun...@sqlite.org on behalf of Scott Frankel Sent: Wed 6/9/2010 11:58 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] copy data from one db to another On Jun 9, 2010, at 12:22 AM, Vivien Malerba wrote: > On 8 June 2010 22:02, Scott Frankel <fran...@circlesfx.com> wrote: >> >> On Jun 8, 2010, at 12:51 PM, Jean-Christophe Deschamps wrote: >> >>> >>>> What's the best way to copy data from one db to another? >>>> >>>> Given 2 databases with identical schemas, one full of data and the >>>> other empty, the brute force way would be to perform selects on the >>>> source db, then for each row, perform an insert into the >>>> destination >>>> db. Is there a more efficient way? >>> >>> The easiest is either to simply copy the file as Igor suggested or >>> use >>> the backup API (very easy too). >> >> I forgot to mention, the source is a PostgreSQL db, not SQLite, so >> there's no source file to copy. Though a backup might be >> interesting ... > > You can use Libgda's gda-sql tool in which you can: > * open a connection to the PostgreSQL db (for example named db1) > * open a connection to the SQLite db (for example named db2) > * bind those 2 connections into a 3rd one, and execute statements like > "insert into db2.table_one_name select * from db1.table_one_name ;" While Libgda looks very interesting, I need a solution that's accessible from common Linux, OSX, and Windows base installs. Looks like the record-by-record approach is the best option for now. Thanks Scott > > If you want more info, tell me. > > Regards, > > Vivien > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users