I've been running weewx for years and wanted to finally upgrade to the new extended schema -- primarily so I can use the weewx-purple extension. After digging through the docs and the mailing list archive, I couldn't find anything that showed a way to do this, so I figured I would share my process here.
Is there an easier way to do this that I just overlooked in the docs? The commands below were all run on Raspbian Buster, but should work on anything running Debian. Most of them will work on any Linux system. The dump and import can take quite some time, depending on what system you are running weewx on. 1. Install the sqlite3 and libsqlite3-mod-impexp packages (impexp will let you export sqlite3 with column names) - sudo apt-get install sqlite3 libsqlite3-mod-impexp 2. Stop weewx - sudo sytemctl stop weewx 3. Move the existing database out of the way - this will also give us a backup just in case - cd /var/lib/weewx - sudo mv weewx.sdb weewx.sdb-20200901 4. Dump the database using the above sqlite3 module: - echo -e ".load libsqlite3_mod_impexp\nselect export_sql('weewx-import.sql','1')" | sudo sqlite3 weewx.sdb-20200901 5. Use your favorite editor to change the schema in weewx.conf. The important line is the last one below, you have to change the schema to use schemas.wview_extended.schema. - - [DataBindings] - - [[wx_binding]] - # The database must match one of the sections in [Databases]. - # This is likely to be the only option you would want to change. - database = archive_sqlite - # The name of the table within the database - table_name = archive - # The manager handles aggregation of data for historical summaries - manager = weewx.wxmanager.WXDaySummaryManager - # The schema defines the structure of the database. - # It is *only* used when the database is created. - #schema = schemas.wview.schema - schema = schemas.wview_extended.schema 6. Start weewx to create an empty database with the new schema, then stop weewx - sudo systemctl start weewx && sleep 5 && sudo systemctl stop weewx 7. Import the old data into the new database - sudo sqlite3 weewx.sdb < weewx-import.sql 8. Start weewx - sudo systemctl start weewx Watch the logs for any issues. If things go bad, stop weewx, move the database backup back to weewx.sdb and revert the change to weewx.conf. That will get you back to where you started. -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/6b954977-6825-4c92-a256-fd480f071e97n%40googlegroups.com.