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 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.
>
> Then you have to use the functions of one library to read your data  
> and the functions of another to write your data.  There's no way to  
> do it inside one SQL command since the SQLite library can't read a  
> PostgreSQL database and the PostgreSQL library can't write a SQLite  
> database.

Right.


> 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.

Before heading down the path of issuing record-by-record statements, I  
thought there might be some hope with generic SQL commands or bulk  
importing ... a newbie's hope ;)

Thanks for the info!
Scott



>
> Simon.
> _______________________________________________
> 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

Reply via email to