WeeWx Database

187 views
Skip to first unread message

Ron Sell

unread,
May 17, 2020, 9:54:59 AM5/17/20
to weewx-user
I upgraded to a new Pi and weewx 4.0.

Old Pi 
weexwx 3.9.2
Database extended for more observations
58 columns
Running for a year

New Pi 
Weewx 4.0
Database not extended Included all of the observstions i needed in the new version.'
113 columns

What is the best way to keep all my old data?


I can't just copy the old database 1 for 1 since they are different.

thanks


columns3.92.
columns4.0

Tom Keffer

unread,
May 17, 2020, 11:06:12 AM5/17/20
to weewx-user
How about doing a dump of the v3.9 database, then delete the CREATE TABLE statement. Then import into the V4 database.

Something like:

# Create a dump, then strip out the CREATE TABLE
echo ".dump" | sqlite3 weewx3.92.sdb | sed -e 's/^CREATE TABLE//' > weewx3.92.sql
# Use the results to insert into the V4.0 table
sqlite3 weewx4.0.sdb < weewx3.92.sql

One thing I want to stress is that there is no difference between a V3.9 database and a V4.0 database. The only difference is that V4.0 offers a new, extended schema. 

-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/378b9004-78d2-4a80-bccb-27b35ecdc64c%40googlegroups.com.

Ron Sell

unread,
May 17, 2020, 8:41:37 PM5/17/20
to weewx...@googlegroups.com
Thanks,
I did the data dump. Its now an SQL file. How do I get it into the weewx4.0 database?

thanks


Tom Keffer

unread,
May 17, 2020, 8:47:52 PM5/17/20
to weewx-user
It's in the commands I suggested. Make a backup first.

Ron Sell

unread,
May 17, 2020, 10:01:25 PM5/17/20
to weewx...@googlegroups.com
Thanks.

Got the script working but now i get this\:
Error: near line 38817: table archive has 114 columns but 59 values were supplied

do i need to modify the .sql to provide the difference in values?


Tom Keffer

unread,
May 18, 2020, 8:17:18 AM5/18/20
to weewx-user
Yeah, I guess that strategy won't work, at least not with a simple ".dump" command.

Can we pause for a second and ask why you are doing this? What was wrong with your old database?

Ron Sell

unread,
May 18, 2020, 8:24:18 AM5/18/20
to weewx...@googlegroups.com
I upgraded to Pi4, 
when I started installing everything I just went with the latest version. I guess i could uninstall weewx4 and go with 3.9.

Tom Keffer

unread,
May 18, 2020, 8:35:51 AM5/18/20
to weewx-user
I don't know how many different ways I can say it, but I'll try again: there is no difference between a V3.9 database and a V4.0 database! 

Just keep using your old database. Copy it over into your new installation and restart weewx. Done.

-tk

Ron Sell

unread,
May 18, 2020, 8:43:57 AM5/18/20
to weewx...@googlegroups.com
Thanks , that what I am doing now. I appreciate all the help.

Easiest way :
Uninstall 4.0
Install 3.9
Configure Weewx 
Done

Ron Sell

unread,
May 29, 2020, 9:55:30 AM5/29/20
to weewx-user
I added all of the Data to my new database. It imported usinf the .SQL.

I rn a query on the archive table
SQLite: select count(*) from archive and all 80,000 records are in there.

None of my reports reflect it. ran sudo wee_reports 
To unsubscribe from this group and stop receiving emails from it, send an email to weewx...@googlegroups.com.

Tom Keffer

unread,
May 29, 2020, 4:28:11 PM5/29/20
to weewx-user
1. Log?
2. Not all images and HTML files get replaced with every reporting cycle. Try deleting them all and then running wee_reports again.

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/cebbe173-4337-4cde-8af6-94eb809a83f3%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages