weectl database transfer ignores fields missing in destination database

18 views
Skip to first unread message

Peter Fletcher

unread,
Nov 22, 2025, 12:40:07 PM (2 days ago) Nov 22
to weewx-development
I recently used weectl database transfer to copy the contents of a large sqlite weewx database (5 years of data) into a newly created mariadb database on a networked server. I had not realized that the template I had used to create the mariadb database was for a previous version of the weewx database, to which I had subsequently added four new fields. The transfer proceeded without errors or problems, and I didn't notice the missing fields in the mariadb database until I tried to use a script of my own to bring it right up to date. For the weectl utility to handle missing fields (on either side) politely is arguably a feature, rather than a bug, but I do think that it should issue a warning before starting the transfer if the logical structure of the two database tables is not identical.

Vince Skahan

unread,
Nov 22, 2025, 3:24:37 PM (2 days ago) Nov 22
to weewx-development
https://github.com/weewx/weewx/wiki/Transfer%20from%20sqlite%20to%20MySQL#using-wee_database seems to indicate that if you are using a user-customized schema it should work ok if you create a schema file from custom 'from' database and reference it in your weewx.conf file...

 It will use the database archive_mysql in the [Databases] section of weewx.conf, and the wview_extended database schema. If this is not the case (e.g., you use a modified schema) you will need to alter one of more of the above settings accordingly.

Peter Fletcher

unread,
Nov 22, 2025, 4:57:07 PM (2 days ago) Nov 22
to weewx-development
From this recent experience, it appears that the contents of all the fields that exist in both databases are copied across. The older database template that I used to create the initial mariadb database already contained some additional 'special' fields, but I had never altered the default schema file reference in weewx.conf, and still haven't done so. Once I had updated the structure of the mariadb database to include the more recently added fields, running the weectl database transfer resulted in a successful transfer of the contents of all the fields from the old sqlite database.
Reply all
Reply to author
Forward
0 new messages