Dana Roode <dana.ro...@gmail.com> writes:

> Is there a way to extract archive records from one weewx.sdb file and 
> import then into another?  I see there is a utility that allows importing 
> of CSV data files.
>
> My linux system died on September 9th and I did not have time to build a 
> new one right away (the system and weather station is located 80 miles away 
> from me).  I did have the old one from about 10 months ago, and I put that 
> in line.  It received a couple of weeks of records from the Davis Vantage 
> Pro2 weather station.  I setup the new system with the database I had 
> through September 9th and now that database is the active one.  I'd like to 
> move a few weeks of data from the interim system to the active one.

So you have:

  a system that ran until sep 9, and has all data from the beginning
  until then, plus from a few days ago until now, and is getting new
  data ("active")

  a system from 10 months ago, that you also ran recently.  This has
  data from the beginning to december 2018, and also sep 9 to a few days
  ago ("interim")

I am unclear on programs, etc.  but you can do this with sqlite3 command
line tools and an editor, carefully.


first, BACK UP the active system weewx.sdb, to multiple other places.
Do the same with the interim one.


run 'sqlite3 weewx.sdb .dump' onto a file on the interim system.
Extract just the insert statements for the archive table.  Sort them
numerically (with sort(1) perhaps).

Do the same with the active system, just so you can look.

Figure out which timestamps are missing from the active system.
Select the lines from the interim dump that correspond and put them in 
"missing.sql"

then on the active  system

sqlite3 weewx.sdb < missing.sql

then you'll need to rebuild archive records.   It really helps to know a
little sql but you only need to sort and select.


It is of course possible to write a program to open both databases and
look for what's missing, tell you about that, and copy records.

-- 
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 weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/rmi8sqcy550.fsf%40s1.lexort.com.

Reply via email to