Thank you Walt and Les!

Both of these suggestions are great and greatly appreciated!  I will make a
backup of my database and try one or both of these today, time permitting.

Ernie

On Sun, May 9, 2021 at 7:53 AM [email protected] <[email protected]> wrote:

> I made a goof in my previous post.  ATTACH is an SQL statement, not a dot
> command.  It should be:
>
> attach database 'weewx.sdb' as db1;
> attach database 'weewx2.sdb' as db2;
> update db1.archive set rain = (select rain from db2.archive where
> db1.archive.datetime == db2.archive.datetime)
>  where date(db1.archive.datetime, 'unixepoch', 'localtime') between
> '2021-01-01' and '2021-05-01';
> .exit
>
> Walt
>
> On Saturday, May 8, 2021 at 1:29:44 PM UTC-5 ln77 wrote:
>
>> Here’s an outline of what I would do.  I use mysql and know nothing about
>> sqlite, but assume the basic export and delete operations are easy.
>> 1. Export the data you want from the old sqlite database into a CSV
>> file.  Export the full archive records, not just the missing field(s).
>> 2. Edit the CSV file if needed, to remove some records or whatever.
>> 3. Use sqlite to delete from the current database the records
>> corresponding to those in the CSV file.  (backup copy of db, like you said!)
>> 4. Use wee_import to import the CSV file into the current database.
>> 5. Use wee_database to drop and rebuilt the daily summaries in weewx.
>>
>> I used something like this to resurrect a bunch of historical data after
>> a severe case of user error earlier this year.
>>
>>   -Les
>>
>>
>>
>> On 8 May 2021, at 7:46, Ernest Jillson <[email protected]> wrote:
>>
>> I imported years of data from wunderground into my weewx db. There was a
>> period of very bad rain data due to a malfunctioning tipping bucket. Also
>> had a day where a small grasshopper managed to get into the little hole,
>> then proceeded to rack up about 15 inches of rain for me that day while
>> trying to escape.
>>
>> I stopped weewx, made a copy of my db, then used sqlite browser to remove
>> all of the bad rain data, day by day, week by week. When I was satisfied, I
>> restarted weewx and life was good.
>>
>> It wasn't until a month later, while flipping through some of my past
>> data that I realized I had somehow managed to remove much more data than I
>> wanted to. I mean, we're talking like a year's worth of rain data.
>>
>> I don't want to import those days all over again, but I can if that's the
>> only way. I'd much rather like to find a way to "bring over" the rain from
>> the saved database for a range of dates, then start the fixing process
>> again. When I brought the data over from wunderground, there were lots of
>> dew point/humidity and temperature anomolies I had to fix as well.
>>
>> My question:  Is there a way (perhaps using the sqlite browser) to import
>> a column (rain) from one database (the saved one) to the new database for
>> just a range of dates?
>>
>> Thanks in advance!
>>
>>
>> --
>> 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/CAC5oUmN6qQVrx0YTCLHhkKRdxJAg7%3DEjtcwDkudBO8bzJm956A%40mail.gmail.com
>> <https://groups.google.com/d/msgid/weewx-user/CAC5oUmN6qQVrx0YTCLHhkKRdxJAg7%3DEjtcwDkudBO8bzJm956A%40mail.gmail.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/9c58d701-884a-475b-9b90-9426241249a3n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/9c58d701-884a-475b-9b90-9426241249a3n%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/CAC5oUmOqcYpA1hBiATaJ1QkJO4hQXBk1EN4GvA7C-pCsbQBQXA%40mail.gmail.com.

Reply via email to