importing data from previous weewx server's database

68 views
Skip to first unread message

ke...@lakeman.org

unread,
Dec 29, 2020, 12:49:40 PM12/29/20
to weewx-user
I've moved my weewx to a new host.  I have the previous weewx.sdb file.  Is the wee_import utility the answer?  How can I bring the old data into the new sdb file?

thanks,
-Keith

vince

unread,
Dec 29, 2020, 2:30:44 PM12/29/20
to weewx-user
I do it manually via dump and restore using sqlite3...
  • Stop weewx
  • Make a copy of your old and new db and work off those copies
    • cp weewx.sdb          /var/tmp/weewx.new.sdb
    • cp your_old_weewx.sdb /var/tmp/weewx.old.sdb
    • cd /var/tmp
  • Dump your old database's archive table to a file
    • echo ".dump archive" | sqlite3 weewx.old.sdb > old.dump.txt
  • Restore that into your new database
    • "cat old.dump.txt | sqlite3 weewx.new.sdb"
    • (and ignore the 'table already exists' warning)
  • Rebuild your daily summaries
    • rename your production weewx.sdb file to something else
    • copy the weewx.new.sdb built above into place as weewx.sdb in the directory weewx expects it in
    • sudo wee_database --rebuild-daily
  • Start weewx
ALWAYS save your original files just in case....never work off your originals.....

The stuff above is loosely tested but should work ok.
Again, ALWAYS save your original files just in case something goes sideways.

Tom Keffer

unread,
Dec 29, 2020, 4:44:26 PM12/29/20
to weewx-user
Before you follow Vince's suggestion, I would do something simpler: just copy over the weewx.sdb file and use it untouched. SQLite files are supposed to be portable across all architectures. 


From experience, I know this is not always true, but there's a 90% chance it will work out.

-tk

--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/ead85a80-686d-4c3e-a9d1-aa7ff291eeb2n%40googlegroups.com.

vince

unread,
Dec 29, 2020, 4:57:10 PM12/29/20
to weewx-user
On Tuesday, December 29, 2020 at 1:44:26 PM UTC-8 Tom Keffer wrote:
Before you follow Vince's suggestion, I would do something simpler: just copy over the weewx.sdb file and use it untouched. SQLite files are supposed to be portable across all architectures. 

ummm -  I might have misread a bit earlier.  I was thinking the question was how to combine old+current databases, which is a different thing of course.
 
Reply all
Reply to author
Forward
0 new messages