Re: [sqlite] copy data from one db to another

2010-06-09 Thread Vivien Malerba
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

Re: [sqlite] copy data from one db to another

2010-06-09 Thread Scott Frankel
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

Re: [sqlite] copy data from one db to another

2010-06-09 Thread Black, Michael (IS)
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

Re: [sqlite] copy data from one db to another

2010-06-09 Thread Vivien Malerba
On 9 June 2010 18:58, Scott Frankel fran...@circlesfx.com wrote: 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

Re: [sqlite] copy data from one db to another

2010-06-09 Thread Rich Shepard
On Wed, 9 Jun 2010, Vivien Malerba wrote: 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

Re: [sqlite] copy data from one db to another

2010-06-09 Thread Vivien Malerba
On 9 June 2010 20:44, Rich Shepard rshep...@appl-ecosys.com wrote: On Wed, 9 Jun 2010, Vivien Malerba wrote: 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

[sqlite] copy data from one db to another

2010-06-08 Thread Scott Frankel
Hi all, 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

Re: [sqlite] copy data from one db to another

2010-06-08 Thread Adam DeVita
start by doing an open db1 (as main) then attach path to db2 as 'db2' insert into main.table_one_name select * from db2.table_one_name ; This selects all records from db2 and puts them into db1 in one statement. Adam On Tue, Jun 8, 2010 at 3:02 PM, Scott Frankel fran...@circlesfx.com wrote:

Re: [sqlite] copy data from one db to another

2010-06-08 Thread Igor Tandetnik
Scott Frankel fran...@circlesfx.com 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 Why not just copy the whole file over? -- Igor Tandetnik ___

Re: [sqlite] copy data from one db to another

2010-06-08 Thread Jean-Christophe Deschamps
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?

Re: [sqlite] copy data from one db to another

2010-06-08 Thread Scott Frankel
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,

Re: [sqlite] copy data from one db to another

2010-06-08 Thread Scott Frankel
On Jun 8, 2010, at 12:07 PM, Adam DeVita wrote: start by doing an open db1 (as main) then attach path to db2 as 'db2' insert into main.table_one_name select * from db2.table_one_name ; This selects all records from db2 and puts them into db1 in one statement. I've been reading about

Re: [sqlite] copy data from one db to another

2010-06-08 Thread Adam DeVita
The db that you open your initial connection to is called main by default. I haven't had the occasion to use a temp or memory db so I can't comment. The attach statement works as normal SQL. attach 'path to your db' as 'some_alias_name' like attach 'c:\temp dir\db2.db' as 'db2' Suppose both

Re: [sqlite] copy data from one db to another

2010-06-08 Thread Simon Slavin
On 8 Jun 2010, at 9:02pm, Scott Frankel 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

Re: [sqlite] copy data from one db to another

2010-06-08 Thread Scott Frankel
On Jun 8, 2010, at 2:28 PM, Simon Slavin wrote: On 8 Jun 2010, at 9:02pm, Scott Frankel 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

Re: [sqlite] copy data from one db to another

2010-06-08 Thread Simon Slavin
On 8 Jun 2010, at 10:47pm, Scott Frankel wrote: On Jun 8, 2010, at 2:28 PM, Simon Slavin wrote: Either write a program to read record-by-record and write record-by- record, or use PostgreSQL functions to write to SQL commands then execute those commands to create a new SQLite database.