Clean the database(s) before a certain date

83 views
Skip to first unread message

Ton vanN

unread,
May 4, 2021, 3:14:38 PM5/4/21
to weewx-user
Have started operation of WeeWX with the Simulator.
Now switched to Tempest, and getting real data.

The thread https://groups.google.com/g/weewx-user/c/NJ_XFLbWrNc/m/fpRqGIBWBQAJ describes a method to transition the database(s) from Simulator to 'Real' sensor by defining completely new database(s).
But what is the easy way to wipe the data in the database(s) while maintaining the datastructure?
In other words:
can the goal be achieved with less action than redefinition according to steps 2.+3. in the quoted message?

gjr80

unread,
May 4, 2021, 4:03:37 PM5/4/21
to weewx-user
The thread you linked describes the process to (1) have WeeWX use a clean database and (2) change the driver from simulator to FineOffsetUSB (fousb). Step 3 was all about the latter, it has nothing to do with clearing the database. If you simply want to have WeeWX start with a clean database then the easiest thing to do is to stop weewx, delete the database file (a default install will use database weewx.sdb located in either /var/lib/weewx or /home/weewx/archive) and then restart WeeWX. WeeWX will automatically create a clean database during startup. Unless you have manually changed the structure of your archive this will give you a clean database with the same structure (schema) as the original.

Of course if you want to keep the old database/data you should make a copy of the database before deleting.

Gary

Ton vanN

unread,
May 5, 2021, 5:04:14 AM5/5/21
to weewx-user
Gary,
The closing remark in your message is not without merit and needs to be applied ....

;-( Enthousiastically wiped weewx.sdb from /home/weewx/archive (without first shifting a copy elswhere) and now in trouble.
At restart of WeeWX (= with weatherflowudp as driver) no signs of life, except the logging of raw packets (because of related setting).
Then executed the actions as shown in the attached zip-file.
Now headscratching how to proceed:
- with Simulator as datasource everything OK and database filling
- with WeatherflowUDP as driver see raw packets passing, but no further signs of life, seemingly confirmed by time-out information.

A complete fresh reinstall & setup obviously will remedy the problem, but quicker correction would be nice ....

[This problem (in my case) has direct practical relation with 'cleaning' of the database, but possibly better to shift the discussion to another, more appropiate thread dealing with integration of Tempest]

Op dinsdag 4 mei 2021 om 22:03:37 UTC+2 schreef gjr80:
SysLog20210505.rar

gjr80

unread,
May 5, 2021, 5:32:20 AM5/5/21
to weewx-user
A couple of observations. Deleting the database has nothing to do with the Weatherflow driver not working - that is almost certainly due to incorrect setup/config of the Weatherflow driver. Secondly, don’t reinstall. Clearly WeeWX is operating fine (the simulator works fine). Better to spend your time troubleshooting the issue.

I can’t  help much with Weatherflow setup, I am not familiar with the station or the driver. I suggest you revisit the Weatherflow driver setup/config, and if you have no luck start a new thread making sure you post a log extract showing the full WeeWX startup and a few archive periods. A sanitised copy of your weewx.conf would also help (the WeeWX utility wee_debug can help with this, just be sure that whatever you post contains no sensitive info such as user names, passwords, api keys etc, wee_debug should obfuscate these for you but it’s not perfect). You might also find the wiki article Help! Posting to weewx user has some useful advice for getting a good log extract, note the tip to use two terminal sessions, one to issue commands and a second to tail the log.

One final request, appreciate the reason why you might compress files for posting, but it does make life hard for some of us using mobile devices. Plain text is fine - I am told Google has plenty of storage space. If you have problems posting a particular file eg .log, just rename it to .txt with a note explaining.

Gary

Ton vanN

unread,
May 5, 2021, 6:29:27 AM5/5/21
to weewx-user
Gary,
Completely agree with your latest response, and that was reason for my earlier [remark] that for Weatherflow-operation I should turn to a more dedicated thread.
Also agree with your discussion of compressed file or uncompressed text: is dilemma how & when to choose.

Question of 'cleaning database' closed.




Op woensdag 5 mei 2021 om 11:32:20 UTC+2 schreef gjr80:
Reply all
Reply to author
Forward
0 new messages