Changing signal names ("Members") in existing WeeWx database

56 views
Skip to first unread message

engolling

unread,
May 3, 2021, 8:11:18 AM5/3/21
to weewx-user

Hello,

I have an existing WeeWx Database with following signals I generated myself: "Snow_Heigt", "AQM_PM10_0", etc...
With WeeWx 4 some of my signals were introduced as default and I would like to moove my scheme to the default for compatibility reasons with skins and so on.

I would therefore just rename my "old" columns to the new default name (and delete the default comlums if available".
Adjust my old schemes that it is compatible angain an then
  • Reconfigure the Database: wee_database weewx.conf --reconfigure
  • Rebuild the daily tables: wee_database weewx.conf --rebuild-daily
Do you think there is anythink else to take into account? I would like to do it right the first time, since my Database has already 600MB it might take a while ;)

Regards,
engolling

Tom Keffer

unread,
May 3, 2021, 8:19:56 AM5/3/21
to weewx-user
As an alternative, if you are using WeeWX v4.5, you can just use the utility wee_database with the --rename-column option.

wee_database --rename-column=old_name --to-name=new_name

This has the advantage that it directly alters the database, so it is very fast. 

Make a backup first.

--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/5ff06bd8-d3bd-459f-84aa-d3f65f1ab9bcn%40googlegroups.com.

engolling

unread,
May 3, 2021, 2:55:01 PM5/3/21
to weewx-user
Thank you for your quick answer. I will give it a try.

Do I have to make sure if the new_name does not exist already (as far as I have seen in this is not the case for me) or would it be overridden?

Regards,
engolling

engolling

unread,
May 5, 2021, 2:00:51 PM5/5/21
to weewx-user
Hallo, I used the rename-colum option of the wee_database utility and it worked fine. Thank you for the hint.
I noticed one thing concerning case sensitivity. I wanted to rename "CO2" to "co2" but I got the following output:
pi@WeatherDuinoPI:~ $ wee_database --rename-column=CO2 --to-name=co2
Using configuration file /etc/weewx/weewx.conf
Using database binding 'wx_binding', which is bound to database 'archive_sqlite'
Rename column 'CO2' to 'co2' (y/n)? y
Traceback (most recent call last):
  File "/usr/share/weewx/weedb/sqlite.py", line 30, in guarded_fn
    return fn(*args, **kwargs)
  File "/usr/share/weewx/weedb/sqlite.py", line 219, in execute
    return sqlite3.Cursor.execute(self, *args, **kwargs)
sqlite3.OperationalError: there is already another table or index with this name: archive_day_co2

Seems as there is a problem with case sensitivity, so I changed the name to "carbon" and then to "co2" as workaround.

Regards,
engolling
Reply all
Reply to author
Forward
0 new messages