I seem to recall there was a thread on the forum about this not too long
ago.

The simplest would be to dump one file, using the tools sqlite3, then
import into the other, again using sqlite3. Something like (NOT TESTED):

echo ".dump archive" | sqlite3 file1.sdb | grep -v 'CREATE TABLE' >file1.sql
sqlite3 file2.sdb < file1.sql

where file1.sdb is the sqlite database you want to add to file2.sdb.

The first line dumps file1.sdb, removing the 'CREATE TABLE' statement (you
don't want it because you already have the table in file2.sdb). It saves
the results to file1.sql, which will be full of SQL "INSERT" statements.

The second line then uses that file to insert the new data into file2.sdb.

Needless to say, make backups first.

-tk






On Thu, Apr 23, 2020 at 8:59 PM B Major <[email protected]> wrote:

> I would like to merge 2 weewx SQLite databases. I am currently planning to
> use the wee_import function. Is there a better way to do this?
>
> The back story here is that I recently got a new desktop. I installed the
> latest version of weewx and had it running in short order. I have my old
> weewx SQLite database. I'd like to keep all that data. As noted, I was
> going to just use wee_import to the new database after extracting the
> records from the old one. But given that  it appears that these are of the
> same format is there an easier way to do this?  I've been running the new
> system for a couple of weeks so swapping out databases may be an option but
> I'd like to keep those 2 weeks of data. These files are Linux based.
>
> Any suggestions or ideas for ease of effort would be appreciated.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/f227d9ab-78ed-41b0-a7ee-75a1114dcb8e%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/f227d9ab-78ed-41b0-a7ee-75a1114dcb8e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEBenHtg03EAYeS%2Bf2p%3DSNbCkPheuOSs72CT2c%2BY%2BSDLFA%40mail.gmail.com.

Reply via email to