From c7f1549acf69ee24f355616e161c3067e477422f Mon Sep 17 00:00:00 2001 From: Tom Keffer Date: Mon, 3 Nov 2025 13:25:26 -0800 Subject: [PATCH 01/10] Fix problem where weectl database reconfigure fails. If a schema has been specified, weewx.schemas is never imported, so weewx is not defined. --- docs_src/changes.md | 3 +++ src/weewx/manager.py | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs_src/changes.md b/docs_src/changes.md index 9d29422c..08da010b 100644 --- a/docs_src/changes.md +++ b/docs_src/changes.md @@ -3,6 +3,9 @@ WeeWX change history ### 5.2.1 MM/DD/YYYY +Fix problem that prevented `weectl database reconfigure` from working in cases +where a schema was specified. + Fix problem when importing data into a MySQL database. PR #[1025](https://github.com/weewx/weewx/pull/1025). Thanks to user Robert! diff --git a/src/weewx/manager.py b/src/weewx/manager.py index e12a9149..4c21db2f 100644 --- a/src/weewx/manager.py +++ b/src/weewx/manager.py @@ -65,9 +65,9 @@ import weedb import weeutil.config import weeutil.weeutil import weewx.accum -import weewx.units import weewx.xtypes from weeutil.weeutil import timestamp_to_string, to_int, TimeSpan +from weewx.units import GenWithConvert log = logging.getLogger(__name__) @@ -708,8 +708,7 @@ def reconfig(old_db_dict, new_db_dict, new_unit_system=None, new_schema=None, dr new_schema = weewx.schemas.wview_extended.schema with Manager.open_with_create(new_db_dict, schema=new_schema) as new_archive: # Wrap the input generator in a unit converter. - record_generator = weewx.units.GenWithConvert(old_archive.genBatchRecords(), - new_unit_system) + record_generator = GenWithConvert(old_archive.genBatchRecords(), new_unit_system) if not dry_run: # This is very fast because it is done in a single transaction context: new_archive.addRecord(record_generator) From 758690f7501f8c6212379dc3929bd9d1f9250a5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jiri=20Cincura=20=E2=86=B9?= Date: Mon, 3 Nov 2025 22:34:24 +0100 Subject: [PATCH 02/10] Added a note about including `weewx.restx.StdWOWBE` in `restful_services`. (#1028) --- docs_src/upgrade.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs_src/upgrade.md b/docs_src/upgrade.md index 1f71eb78..67a1205e 100644 --- a/docs_src/upgrade.md +++ b/docs_src/upgrade.md @@ -124,6 +124,8 @@ directly underneath. When you're done, it should look something like this: +Finally, `weewx.restx.StdWOWBE` should be added into `restful_services`. + ### Luminosity and Illuminance From 4d470f34050cfe80da11b4da7dfe60efdf5486a8 Mon Sep 17 00:00:00 2001 From: Tom Keffer Date: Wed, 12 Nov 2025 13:33:07 -0800 Subject: [PATCH 03/10] Include instructions on making sure MySQL/MariaDB starts before WeeWX Alternative to PR #1030. --- docs_src/usersguide/mysql-mariadb.md | 11 +++++++++++ src/weewx_data/util/systemd/weewx.service | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/docs_src/usersguide/mysql-mariadb.md b/docs_src/usersguide/mysql-mariadb.md index 2b2c7554..f1abff6e 100644 --- a/docs_src/usersguide/mysql-mariadb.md +++ b/docs_src/usersguide/mysql-mariadb.md @@ -91,3 +91,14 @@ again assuming user `weewx` with password `weewx`. Adjust as necessary. CREATE USER 'weewx'@'localhost' IDENTIFIED BY 'weewx'; GRANT select, update, create, delete, insert, alter, drop ON weewx.* TO weewx@localhost; ``` + +### 5. Make sure MySQL/MariaDB starts before WeeWX + +You may want to add the following to your `weewx.service` file (generally +located in `/etc/systemd/system/weewx.service`), under the `[Unit]` section: + +```ini +After=mariadb.service mysqld.service +Wants=mariadb.service mysqld.service +``` +This will ensure that MySQL/MariaDB starts before WeeWX. \ No newline at end of file diff --git a/src/weewx_data/util/systemd/weewx.service b/src/weewx_data/util/systemd/weewx.service index ff16cbab..df3f8613 100644 --- a/src/weewx_data/util/systemd/weewx.service +++ b/src/weewx_data/util/systemd/weewx.service @@ -8,6 +8,14 @@ After=time-sync.target Wants=network-online.target After=network-online.target +# If you are using MySQL uncomment the following lines: +# After=mysqld.service +# Wants=mysqld.service + +# If you are using MariaDB uncomment the following lines: +# After=mariadb.service +# Wants=mariadb.service + [Service] ExecStart=WEEWX_PYTHON WEEWXD WEEWX_CFGDIR/weewx.conf StandardOutput=null From 5722819e407a952733f020451214eccf7090b71e Mon Sep 17 00:00:00 2001 From: Aslak Vaa <46241067+aslak47@users.noreply.github.com> Date: Wed, 12 Nov 2025 22:36:51 +0100 Subject: [PATCH 04/10] Norwegian (#1032) * Added Norwegian translations for Skyfield Almanac --- src/weewx_data/skins/Seasons/lang/no.conf | 2 +- src/weewx_data/skins/Standard/lang/no.conf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/weewx_data/skins/Seasons/lang/no.conf b/src/weewx_data/skins/Seasons/lang/no.conf index b054f656..3ca46162 100644 --- a/src/weewx_data/skins/Seasons/lang/no.conf +++ b/src/weewx_data/skins/Seasons/lang/no.conf @@ -155,7 +155,7 @@ unit_system = metricwx [Almanac] # The labels to be used for the phases of the moon: - moon_phases = Nymåne, Voksende månesigd, Voksende halvmåne, Voksende fullmåne, Fullmåne, Minkende fullmåne, Minkende halvmåne, Minkende månesigd + moon_phases = Nymåne, Voksende sigd, Første kvarter, Voksende måne, Fullmåne, Avtakende måne, Siste kvarter, Avtakende sigd [Texts] "About this station" = "Om denne stasjonen" diff --git a/src/weewx_data/skins/Standard/lang/no.conf b/src/weewx_data/skins/Standard/lang/no.conf index 300feb41..03c67537 100644 --- a/src/weewx_data/skins/Standard/lang/no.conf +++ b/src/weewx_data/skins/Standard/lang/no.conf @@ -44,7 +44,7 @@ unit_system = metricwx [[Ordinates]] # Ordinal directions. The last one should be for no wind direction - directions = N, NNE, NØ, ØNØ, Ø, ØSØ, SØ, SSØ, S, SSV, SV, VSV, V, VNV, NV, NNV, N/A + directions = N, NNØ, NØ, ØNØ, Ø, ØSØ, SØ, SSØ, S, SSV, SV, VSV, V, VNV, NV, NNV, N/A [Labels] @@ -111,7 +111,7 @@ unit_system = metricwx [Almanac] # The labels to be used for the phases of the moon: - moon_phases = Nymåne, Voksende månesigd, Halvmåne første kvarter, Voksende måne (ny), Fullmåne, Minkende måne (ne), Halvmåne siste kvarter, Minkende månesigd + moon_phases = Nymåne, Voksende sigd, Første kvarter, Voksende måne, Fullmåne, Avtakende måne, Siste kvarter, Avtakende sigd [Texts] "7-day" = "7-dager" From 69881f198407f7d10e05cc80b34e041cae42bcbb Mon Sep 17 00:00:00 2001 From: bastelratte <237489228+bastelratte@users.noreply.github.com> Date: Wed, 12 Nov 2025 22:37:37 +0100 Subject: [PATCH 05/10] Update de.conf (#1033) Various translation adjustments DE --- src/weewx_data/skins/Seasons/lang/de.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/weewx_data/skins/Seasons/lang/de.conf b/src/weewx_data/skins/Seasons/lang/de.conf index 82fbce9c..0e568b62 100644 --- a/src/weewx_data/skins/Seasons/lang/de.conf +++ b/src/weewx_data/skins/Seasons/lang/de.conf @@ -71,7 +71,7 @@ unit_system = metricwx lightning_distance = Blitzentfernung lightning_strike_count = Blitzanzahl luminosity = Helligkeit - outHumidity = Luftfeuchte + outHumidity = Außenluftfeuchte outTemp = Außentemperatur pressure = abs. Luftdruck # QFE pressureRate = Luftdruckänderung @@ -96,7 +96,7 @@ unit_system = metricwx windgustvec = Böen-Vektor windrun = Windverlauf windSpeed = Windgeschwindigkeit - windvec = Wind-Vektor + windvec = Windvektor # used in Seasons skin but not defined feel = gefühlte Temperatur @@ -109,7 +109,7 @@ unit_system = metricwx rainBatteryStatus = Regenmesser referenceVoltage = Referenz rxCheckPercent = Signalqualität - supplyVoltage = Versorgung + supplyVoltage = Versorgungsspannung txBatteryStatus = Übertrager windBatteryStatus = Anemometer batteryStatus1 = Batterie1 From bde904c7de8b72bcb687a18dd19e67fb0369c639 Mon Sep 17 00:00:00 2001 From: Tom Keffer Date: Wed, 12 Nov 2025 18:18:13 -0800 Subject: [PATCH 06/10] Correct location for weewx.service --- docs_src/usersguide/mysql-mariadb.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs_src/usersguide/mysql-mariadb.md b/docs_src/usersguide/mysql-mariadb.md index f1abff6e..b6d14eb5 100644 --- a/docs_src/usersguide/mysql-mariadb.md +++ b/docs_src/usersguide/mysql-mariadb.md @@ -94,8 +94,9 @@ GRANT select, update, create, delete, insert, alter, drop ON weewx.* TO weewx@lo ### 5. Make sure MySQL/MariaDB starts before WeeWX -You may want to add the following to your `weewx.service` file (generally -located in `/etc/systemd/system/weewx.service`), under the `[Unit]` section: +Locate your WeeWX service file. Depending on your installation method, it will +located at either `/lib/systemd/system/weewx.service` or `/etc/systemd/system/weewx.service`). +Under the `[Unit]` section, add the following lines: ```ini After=mariadb.service mysqld.service From e153e133391aaf8fe9a4a71f5761a20be0da1a10 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Fri, 14 Nov 2025 16:00:02 +0000 Subject: [PATCH 07/10] Remove unnecessary UNIQUE index on PK (#1034) SQLite creates a unique index in addition to the clustered index for `INTEGER NOT NULL UNIQUE PRIMARY KEY` columns. The index is not necessary to enforce uniqueness and is not used for existing queries. Removing these unnecessary indexes reduced my database from 444MB to 395MB (11%). Remove the `UNIQUE` constraint from `INTEGER PRIMARY KEY` columns to avoid the unnecessary overhead. Note: Testing with MariaDB 11.8.3 indicates that the `UNIQUE` constraint is ignored (`SHOW CREATE TABLE` does not include `UNIQUE` and `SHOW INDEX` only shows a `PRIMARY` index.) Removing it will have no effect that I am aware of for MariaDB. Fixes: #1031 Signed-off-by: Kevin Locke --- docs_src/changes.md | 4 ++++ src/weedb/sqlite.py | 2 +- src/weedb/tests/check_mysql.py | 2 +- src/weedb/tests/check_sqlite.py | 2 +- src/weedb/tests/test_errors.py | 2 +- src/weedb/tests/test_weedb.py | 8 ++++---- src/weewx/manager.py | 6 +++--- src/weewx/schemas/wview.py | 2 +- src/weewx/schemas/wview_extended.py | 2 +- src/weewx/schemas/wview_small.py | 2 +- src/weewx/tests/test_database.py | 2 +- src/weewx/tests/tst_schema.py | 2 +- 12 files changed, 20 insertions(+), 16 deletions(-) diff --git a/docs_src/changes.md b/docs_src/changes.md index 08da010b..63e93ac5 100644 --- a/docs_src/changes.md +++ b/docs_src/changes.md @@ -3,6 +3,10 @@ WeeWX change history ### 5.2.1 MM/DD/YYYY +Remove unnecessary `UNIQUE` index on `PRIMARY KEY` columns in SQLite, achieving +size reduction of ~10%. Existing database schemas are not modified. Users +desiring size reduction are advised to consider manually migrating. + Fix problem that prevented `weectl database reconfigure` from working in cases where a schema was specified. diff --git a/src/weedb/sqlite.py b/src/weedb/sqlite.py index 8118ec5d..8779e348 100644 --- a/src/weedb/sqlite.py +++ b/src/weedb/sqlite.py @@ -268,7 +268,7 @@ class Cursor(sqlite3.Cursor, weedb.Cursor): if obs_name in column_names: continue no_null_str = " NOT NULL" if no_null else "" - pk_str = " UNIQUE PRIMARY KEY" if pk else "" + pk_str = " PRIMARY KEY" if pk else "" default_str = " DEFAULT %s" % default if default is not None else "" create_list.append("`%s` %s%s%s%s" % (obs_name, obs_type, no_null_str, pk_str, default_str)) diff --git a/src/weedb/tests/check_mysql.py b/src/weedb/tests/check_mysql.py index 723be70f..317364e1 100644 --- a/src/weedb/tests/check_mysql.py +++ b/src/weedb/tests/check_mysql.py @@ -150,7 +150,7 @@ class TestMySQL(unittest.TestCase): with Cursor(user='weewx1', password='weewx1') as cursor: cursor.execute("CREATE DATABASE test_weewx1") cursor.execute("CREATE TABLE test_weewx1.test1 " - "( dateTime INTEGER NOT NULL UNIQUE PRIMARY KEY, col1 int, col2 int)") + "( dateTime INTEGER NOT NULL PRIMARY KEY, col1 int, col2 int)") cursor.execute("INSERT INTO test_weewx1.test1 " "(dateTime, col1, col2) VALUES (1, 10, 20)") with self.assertRaises(IntegrityError) as e: diff --git a/src/weedb/tests/check_sqlite.py b/src/weedb/tests/check_sqlite.py index d657eb78..119b7883 100644 --- a/src/weedb/tests/check_sqlite.py +++ b/src/weedb/tests/check_sqlite.py @@ -100,7 +100,7 @@ class TestSqlite3(unittest.TestCase): def test_duplicate_key(self): with Cursor(sqdb1) as cursor: - cursor.execute("CREATE TABLE test1 ( dateTime INTEGER NOT NULL UNIQUE PRIMARY KEY, col1 int, col2 int)") + cursor.execute("CREATE TABLE test1 ( dateTime INTEGER NOT NULL PRIMARY KEY, col1 int, col2 int)") cursor.execute("INSERT INTO test1 (dateTime, col1, col2) VALUES (1, 10, 20)") with self.assertRaises(IntegrityError) as e: cursor.execute("INSERT INTO test1 (dateTime, col1, col2) VALUES (1, 30, 40)") diff --git a/src/weedb/tests/test_errors.py b/src/weedb/tests/test_errors.py index 363f6da8..ab336c72 100644 --- a/src/weedb/tests/test_errors.py +++ b/src/weedb/tests/test_errors.py @@ -180,7 +180,7 @@ class Common(unittest.TestCase): weedb.create(db_dict) connect = weedb.connect(db_dict) cursor = connect.cursor() - cursor.execute("CREATE TABLE test1 ( dateTime INTEGER NOT NULL UNIQUE PRIMARY KEY, col1 int, col2 int)") + cursor.execute("CREATE TABLE test1 ( dateTime INTEGER NOT NULL PRIMARY KEY, col1 int, col2 int)") cursor.execute("INSERT INTO test1 (dateTime, col1, col2) VALUES (1, 10, 20)") with self.assertRaises(weedb.IntegrityError) as e: cursor.execute("INSERT INTO test1 (dateTime, col1, col2) VALUES (1, 30, 40)") diff --git a/src/weedb/tests/test_weedb.py b/src/weedb/tests/test_weedb.py index 29811498..3f7f53b7 100644 --- a/src/weedb/tests/test_weedb.py +++ b/src/weedb/tests/test_weedb.py @@ -48,10 +48,10 @@ class Common(unittest.TestCase): weedb.create(self.db_dict) with weedb.connect(self.db_dict) as _connect: with weedb.Transaction(_connect) as _cursor: - _cursor.execute("CREATE TABLE test1 (dateTime INTEGER NOT NULL UNIQUE PRIMARY KEY," + _cursor.execute("CREATE TABLE test1 (dateTime INTEGER NOT NULL PRIMARY KEY," " min REAL, mintime INTEGER, max REAL, maxtime INTEGER, sum REAL," " count INTEGER, descript CHAR(20));") - _cursor.execute("CREATE TABLE test2 (dateTime INTEGER NOT NULL UNIQUE PRIMARY KEY," + _cursor.execute("CREATE TABLE test2 (dateTime INTEGER NOT NULL PRIMARY KEY," " min REAL, mintime INTEGER, max REAL, maxtime INTEGER, sum REAL, " "count INTEGER, descript CHAR(20));") for irec in range(20): @@ -151,7 +151,7 @@ class Common(unittest.TestCase): with weedb.connect(self.db_dict) as _connect: with _connect.cursor() as _cursor: _cursor.execute( - "CREATE TABLE test1 (dateTime INTEGER NOT NULL UNIQUE PRIMARY KEY, x REAL )") + "CREATE TABLE test1 (dateTime INTEGER NOT NULL PRIMARY KEY, x REAL )") # Now start the transaction _connect.begin() @@ -176,7 +176,7 @@ class Common(unittest.TestCase): # create the table outside the transaction. We're not as concerned about a # transaction failing when creating a table, because it only happens the first time # weewx starts up. - _connect.execute("CREATE TABLE test1 (dateTime INTEGER NOT NULL UNIQUE PRIMARY KEY, " + _connect.execute("CREATE TABLE test1 (dateTime INTEGER NOT NULL PRIMARY KEY, " "x REAL );") # We're going to trigger the rollback by raising a bogus exception. diff --git a/src/weewx/manager.py b/src/weewx/manager.py index 4c21db2f..2b9ee6a6 100644 --- a/src/weewx/manager.py +++ b/src/weewx/manager.py @@ -1016,7 +1016,7 @@ class DaySummaryManager(Manager): # Schemas used by the daily summaries: day_schemas = { 'scalar': [ - ('dateTime', 'INTEGER NOT NULL UNIQUE PRIMARY KEY'), + ('dateTime', 'INTEGER NOT NULL PRIMARY KEY'), ('min', 'REAL'), ('mintime', 'INTEGER'), ('max', 'REAL'), @@ -1027,7 +1027,7 @@ class DaySummaryManager(Manager): ('sumtime', 'INTEGER') ], 'vector': [ - ('dateTime', 'INTEGER NOT NULL UNIQUE PRIMARY KEY'), + ('dateTime', 'INTEGER NOT NULL PRIMARY KEY'), ('min', 'REAL'), ('mintime', 'INTEGER'), ('max', 'REAL'), @@ -1047,7 +1047,7 @@ class DaySummaryManager(Manager): # SQL statements used by the metadata in the daily summaries. meta_create_str = "CREATE TABLE %s_day__metadata (name CHAR(20) NOT NULL " \ - "UNIQUE PRIMARY KEY, value TEXT);" + "PRIMARY KEY, value TEXT);" meta_replace_str = "REPLACE INTO %s_day__metadata VALUES(?, ?)" meta_select_str = "SELECT value FROM %s_day__metadata WHERE name=?" diff --git a/src/weewx/schemas/wview.py b/src/weewx/schemas/wview.py index 89d07967..7d0663fb 100644 --- a/src/weewx/schemas/wview.py +++ b/src/weewx/schemas/wview.py @@ -21,7 +21,7 @@ # with V4, a new style was added, which allows schema for the daily summaries # to be expressed explicitly. # ============================================================================= -schema = [('dateTime', 'INTEGER NOT NULL UNIQUE PRIMARY KEY'), +schema = [('dateTime', 'INTEGER NOT NULL PRIMARY KEY'), ('usUnits', 'INTEGER NOT NULL'), ('interval', 'INTEGER NOT NULL'), ('barometer', 'REAL'), diff --git a/src/weewx/schemas/wview_extended.py b/src/weewx/schemas/wview_extended.py index 3df37350..9057cdee 100644 --- a/src/weewx/schemas/wview_extended.py +++ b/src/weewx/schemas/wview_extended.py @@ -13,7 +13,7 @@ # ============================================================================= # NB: This schema is specified using the WeeWX V4 "new-style" schema. # ============================================================================= -table = [('dateTime', 'INTEGER NOT NULL UNIQUE PRIMARY KEY'), +table = [('dateTime', 'INTEGER NOT NULL PRIMARY KEY'), ('usUnits', 'INTEGER NOT NULL'), ('interval', 'INTEGER NOT NULL'), ('altimeter', 'REAL'), diff --git a/src/weewx/schemas/wview_small.py b/src/weewx/schemas/wview_small.py index 7ae21f78..0b6b4f96 100644 --- a/src/weewx/schemas/wview_small.py +++ b/src/weewx/schemas/wview_small.py @@ -14,7 +14,7 @@ # ============================================================================= # NB: This schema is specified using the WeeWX V4 "new-style" schema. # ============================================================================= -table = [('dateTime', 'INTEGER NOT NULL UNIQUE PRIMARY KEY'), +table = [('dateTime', 'INTEGER NOT NULL PRIMARY KEY'), ('usUnits', 'INTEGER NOT NULL'), ('interval', 'INTEGER NOT NULL'), ('altimeter', 'REAL'), diff --git a/src/weewx/tests/test_database.py b/src/weewx/tests/test_database.py index 358534f6..f6af1ebf 100644 --- a/src/weewx/tests/test_database.py +++ b/src/weewx/tests/test_database.py @@ -22,7 +22,7 @@ weeutil.logger.setup('weetest_database') archive_sqlite = {'database_name': '/var/tmp/weewx_test/weedb.sdb', 'driver':'weedb.sqlite'} archive_mysql = {'database_name': 'test_weedb', 'user':'weewx1', 'password':'weewx1', 'driver':'weedb.mysql'} -archive_schema = [('dateTime', 'INTEGER NOT NULL UNIQUE PRIMARY KEY'), +archive_schema = [('dateTime', 'INTEGER NOT NULL PRIMARY KEY'), ('usUnits', 'INTEGER NOT NULL'), ('interval', 'INTEGER NOT NULL'), ('barometer', 'REAL'), diff --git a/src/weewx/tests/tst_schema.py b/src/weewx/tests/tst_schema.py index 0b6965f2..237a60e9 100644 --- a/src/weewx/tests/tst_schema.py +++ b/src/weewx/tests/tst_schema.py @@ -3,7 +3,7 @@ # # See the file LICENSE.txt for your full rights. # -table = [('dateTime', 'INTEGER NOT NULL UNIQUE PRIMARY KEY'), +table = [('dateTime', 'INTEGER NOT NULL PRIMARY KEY'), ('usUnits', 'INTEGER NOT NULL'), ('interval', 'INTEGER NOT NULL'), ('altimeter', 'REAL'), From ef8a98a38c640eaff71b001928d2c9f5fbf869f3 Mon Sep 17 00:00:00 2001 From: Tom Keffer Date: Mon, 17 Nov 2025 09:30:54 -0800 Subject: [PATCH 08/10] Fix problem that prevented `weewxd` from restarting reliably if a MySQL connection was lost. Fixes Issue #1036 --- docs_src/changes.md | 3 +++ src/weedb/mysql.py | 13 +++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docs_src/changes.md b/docs_src/changes.md index 08da010b..f24df2e0 100644 --- a/docs_src/changes.md +++ b/docs_src/changes.md @@ -9,6 +9,9 @@ where a schema was specified. Fix problem when importing data into a MySQL database. PR #[1025](https://github.com/weewx/weewx/pull/1025). Thanks to user Robert! +Fix problem that prevented `weewxd` from restarting reliably if a MySQL +connection was lost. Fixes [Issue #1036](https://github.com/weewx/weewx/pull/1036). + ### 5.2.0 10/05/2025 diff --git a/src/weedb/mysql.py b/src/weedb/mysql.py index 76121280..182e1486 100644 --- a/src/weedb/mysql.py +++ b/src/weedb/mysql.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2009-2024 Tom Keffer +# Copyright (c) 2009-2025 Tom Keffer # # See the file LICENSE.txt for your full rights. # @@ -8,16 +8,19 @@ import decimal try: + # Typically supplied by the "mysqlclient" package. import MySQLdb except ImportError: - # Maybe the user has "pymysql", a pure-Python version? + # Typically supplied by the "pymysql" package, a pure-Python version. import pymysql as MySQLdb - from pymysql import DatabaseError as MySQLDatabaseError + from pymysql import (DatabaseError as MySQLDatabaseError, + InterfaceError as MySQLInterfaceError) else: try: from MySQLdb import DatabaseError as MySQLDatabaseError except ImportError: - from _mysql_exceptions import DatabaseError as MySQLDatabaseError + from _mysql_exceptions import (DatabaseError as MySQLDatabaseError, + InterfaceError as MySQLInterfaceError) from weeutil.weeutil import to_bool, natural_compare import weedb @@ -60,6 +63,8 @@ def guard(fn): # Default exception is weedb.DatabaseError klass = exception_map.get(errno, weedb.DatabaseError) raise klass(e) + except MySQLInterfaceError as e: + raise weedb.DisconnectError(e) return guarded_fn From 4b3b985740ad8abc06643ea6f41a41b2b6984c95 Mon Sep 17 00:00:00 2001 From: bastelratte <237489228+bastelratte@users.noreply.github.com> Date: Mon, 17 Nov 2025 22:59:56 +0100 Subject: [PATCH 09/10] Update de.conf (#1037) Various translation adjustments DE --- src/weewx_data/skins/Standard/lang/de.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/weewx_data/skins/Standard/lang/de.conf b/src/weewx_data/skins/Standard/lang/de.conf index 87ae422d..92fc708f 100644 --- a/src/weewx_data/skins/Standard/lang/de.conf +++ b/src/weewx_data/skins/Standard/lang/de.conf @@ -48,7 +48,7 @@ interval = Intervall lightning_distance = Blitzentfernung lightning_strike_count = Blitzanzahl - outHumidity = Luftfeuchte + outHumidity = Außenluftfeuchte outTemp = Außentemperatur pressure = abs. Luftdruck # QFE pressureRate = Luftdruckänderung @@ -65,7 +65,7 @@ windgustvec = Böen-Vektor windrun = Windverlauf windSpeed = Windgeschwindigkeit - windvec = Wind-Vektor + windvec = Windvektor # used in Seasons skin but not defined feel = gefühlte Temperatur @@ -78,7 +78,7 @@ rainBatteryStatus = Regenmesser referenceVoltage = Referenz rxCheckPercent = Signalqualität - supplyVoltage = Versorgung + supplyVoltage = Versorgungsspannung txBatteryStatus = Übertrager windBatteryStatus = Anemometer From dfeecdb967a049bf7407f08654351f31f05f84d1 Mon Sep 17 00:00:00 2001 From: Tom Keffer Date: Tue, 18 Nov 2025 15:31:22 -0800 Subject: [PATCH 10/10] Fix formatting issues in change log --- docs_src/changes.md | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/docs_src/changes.md b/docs_src/changes.md index 167c1230..050e4abe 100644 --- a/docs_src/changes.md +++ b/docs_src/changes.md @@ -11,7 +11,7 @@ Fix problem that prevented `weectl database reconfigure` from working in cases where a schema was specified. Fix problem when importing data into a MySQL database. PR -#[1025](https://github.com/weewx/weewx/pull/1025). Thanks to user Robert! +[#1025](https://github.com/weewx/weewx/pull/1025). Thanks to user Robert! Fix problem that prevented `weewxd` from restarting reliably if a MySQL connection was lost. Fixes [Issue #1036](https://github.com/weewx/weewx/pull/1036). @@ -31,14 +31,13 @@ namespace. Addresses [Issue #993](https://github.com/weewx/weewx/issues/993). The WeeWX Almanac is now extensible, allowing other astronomy packages to be used besides `pyephem`. In particular, a WeeWX extension that uses the [Skyfield](https://rhodesmill.org/skyfield/) package is available and can be -installed. See [Issue #981](https://github.com/weewx/weewx/issues/981) and [PR -#988](https://github.com/weewx/weewx/pull/988). Thanks to user Johanna! +installed. See [Issue #981](https://github.com/weewx/weewx/issues/981) +and [PR #988](https://github.com/weewx/weewx/pull/988). Thanks to user Johanna! Fix LOGNAME bug in the weewx-multi sysV script. Thanks to Glenn McKechnie. -Added `illuminance` to the `wview_extended` schema. See [Issue -#992](https://github.com/weewx/weewx/issues/991) and [PR -#992](https://github.com/weewx/weewx/pull/992/files). Thanks to user Jeremy! +Added `illuminance` to the `wview_extended` schema. See [Issue #992](https://github.com/weewx/weewx/issues/991) +and [PR #992](https://github.com/weewx/weewx/pull/992/files). Thanks to user Jeremy! Fix typo that causes phantom values of `soilMoist3` to appear with VantageVue stations. @@ -62,15 +61,13 @@ Ben Cotton! In the Cumulus import code, the prefix `cur_` is used to signify a current value for most observation types. However, there was one exception: `curr_in_temp`. The utility and documentation have been changed to use `cur_in_temp` (one -'`r`'), making all types consistent. Fixes [Issue -#1006](https://github.com/weewx/weewx/issues/1006). +'`r`'), making all types consistent. Fixes [Issue #1006](https://github.com/weewx/weewx/issues/1006). Fix a problem caused by an assumption that delta times are always in seconds. Fixes issue [Issue #1009](https://github.com/weewx/weewx/issues/1009). Fix bug that prevented arbitrary types from being used with `weectl database -add-column`. Fixes issue [Issue -#1007](https://github.com/weewx/weewx/issues/1007). +add-column`. Fixes issue [Issue #1007](https://github.com/weewx/weewx/issues/1007). Fix bug that prevented MySQL and MariaDB versions greater than 10.0 from working. Fixes issue [Issue #1010](https://github.com/weewx/weewx/issues/1010).