Hi Tom,

I saved that code as merge.py and edited the database paths (I'd done a 
Debian package install).  But now I'm not sure where to run it.  In 
/usr/share/weewx (which is where wee_database is), I get "ImportError: No 
module named configobj".  Anywhere else, I get "ImportError: No module 
named weewx.Manager. 

That same configobj error showed up the first time I tried to run 
wee_database, but I solved that by doing cd /usr/share/weewx first.  But 
that's not helping this time.  I'm using sudo in all cases (and not doing 
so gives me permission denied errors).  

My Python skills are only a few steps above Hello World, so I may be 
missing something obvious.  

Thanks for your help.

Lynda.

On Friday, October 23, 2020 at 2:55:11 PM UTC-4 [email protected] wrote:

> Besides Vince's suggestion, here's another one. There's a utility called 
> transfer_db.py in the examples subdirectory that does something very close 
> to what you seek. Modify it slightly, and you'd end up with (NOT TESTED):
>
> from __future__ import with_statement
> from weewx.manager import Manager
>
> old_archive_dict = {'driver'        : 'weedb.sqlite',
>                     'database_name' : '/home/weewx/archive/weewx.sdb'}
>
> new_archive_dict = {'driver'        : 'weedb.sqlite',
>                     'database_name' : '/home/weewx/archive/new.sdb'}
>
> with Manager.open(old_archive_dict) as old_archive:
>     with Manager.open(new_archive_dict) as new_archive:
>
>         # This is very fast because it is done in a single transaction 
> context:
>         new_archive.addRecord(old_archive.genBatchRecords())
>
> This will merge the contents of the "old database" into the "new 
> database". Modify paths for database_name for the old and new databases 
> as necessary. 
>
> Then rebuild the daily summaries of the new database.
>
> -tk
>
> On Fri, Oct 23, 2020 at 10:47 AM vince <[email protected]> wrote:
>
>> I think you're overthinking things.....but your basic steps look good.
>>
>> To import the old data into the new db, you would need to convert your 
>> old db to the new/bigger schema (if your new db uses the big schema), do 
>> the dump, and restore just the INSERT lines (like you did) and 
>> rebuild_daily again.  
>>
>>
>>
>> -- 
>> 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/23d29e1a-7fef-4973-b183-70b032136a58o%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/weewx-user/23d29e1a-7fef-4973-b183-70b032136a58o%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/9580614f-e36f-42c7-9516-396ce1aaf69dn%40googlegroups.com.

Reply via email to