Miután korábban egy régi, frissítgetett rendszeren (előző issue) beindítottuk a scriptet, újra telepítettem az egész rendszert, hogy ne legyenek kavarodott adatok benne.
Ám az új rendszerben más az adatbázis szerkezet, mint a régiről frissített esetben.
A script indításakor panaszkodik, hogy nem talál az adatbázis "States" táblájában "Created" oszlopot és valóban nincs is.
Nincs a feltelepített MariaDB adatbázisban és nincs a gyári tartalmú SQLite adatbázisban sem.
Sajnálatos módon akkor sem működik, ha kézzel hozzáadom ezt az oszlopot a megfelelő típusú oszlopként.
A hiba:
"pymysql.err.OperationalError: (1054, "Unknown column 'created' in 'field list'")"
Bővebben:
2022-06-26 18:25:38.154651 INFO Eon: Starting E.ON reader 2022-06-26 18:25:38.471035 INFO Eon: get verification token from E.ON portal 2022-06-26 18:25:38.780329 INFO Eon: Start receiving data 2022-06-26 18:25:38.907743 WARNING Eon: ------------------------------------------------------------ 2022-06-26 18:25:38.909524 WARNING Eon: Unexpected error in worker for App Eon: 2022-06-26 18:25:38.911161 WARNING Eon: Worker Ags: {'id': '2d39ab768cde4d9cb000eb5d9aea5d76', 'name': 'Eon', 'objectid': '6c7fb789c9c04bea8fd7fed8dc282c37', 'type': 'scheduler', 'function': <bound method Eon.read_data of <read_eon.Eon object at 0x747cc118>>, 'pin_app': True, 'pin_thread': 2, 'kwargs': {'interval': 18000, '__thread_id': 'thread-2'}} 2022-06-26 18:25:38.912758 WARNING Eon: ------------------------------------------------------------ 2022-06-26 18:25:38.916285 WARNING Eon: Traceback (most recent call last): File "/config/appdaemon/apps/eon/read_eon.py", line 243, in get_states cursor.execute(sql, (eon_type)) File "/usr/lib/python3.10/site-packages/pymysql/cursors.py", line 148, in execute result = self._query(query) File "/usr/lib/python3.10/site-packages/pymysql/cursors.py", line 310, in _query conn.query(q) File "/usr/lib/python3.10/site-packages/pymysql/connections.py", line 548, in query self._affected_rows = self._read_query_result(unbuffered=unbuffered) File "/usr/lib/python3.10/site-packages/pymysql/connections.py", line 775, in _read_query_result result.read() File "/usr/lib/python3.10/site-packages/pymysql/connections.py", line 1156, in read first_packet = self.connection._read_packet() File "/usr/lib/python3.10/site-packages/pymysql/connections.py", line 725, in _read_packet packet.raise_for_error() File "/usr/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error err.raise_mysql_exception(self._data) File "/usr/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception raise errorclass(errno, errval) pymysql.err.OperationalError: (1054, "Unknown column 'created' in 'field list'") During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/config/appdaemon/apps/eon/read_eon.py", line 247, in get_states self.log(f"Error - get_states: {err.message}", level="ERROR") AttributeError: 'OperationalError' object has no attribute 'message' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/appdaemon/threading.py", line 904, in worker funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"])) File "/config/appdaemon/apps/eon/read_eon.py", line 33, in read_data eon_1_8_0_report, eon_2_8_0_report = self.get_report_data(profile_data_url, session) File "/config/appdaemon/apps/eon/read_eon.py", line 120, in get_report_data self.collect_daily_data(eon_1_8_0_data, sensor_1_8_0_sensor, eon_1_8_0_report, "EON consumption energy total") File "/config/appdaemon/apps/eon/read_eon.py", line 142, in collect_daily_data rows = self.get_states(eon_sensor, extra_parameter) File "/config/appdaemon/apps/eon/read_eon.py", line 250, in get_states return rows UnboundLocalError: local variable 'rows' referenced before assignment 2022-06-26 18:25:38.918730 WARNING Eon: ------------------------------------------------------------
Miután korábban egy régi, frissítgetett rendszeren (előző issue) beindítottuk a scriptet, újra telepítettem az egész rendszert, hogy ne legyenek kavarodott adatok benne. Ám az új rendszerben más az adatbázis szerkezet, mint a régiről frissített esetben.
A script indításakor panaszkodik, hogy nem talál az adatbázis "States" táblájában "Created" oszlopot és valóban nincs is. Nincs a feltelepített MariaDB adatbázisban és nincs a gyári tartalmú SQLite adatbázisban sem. Sajnálatos módon akkor sem működik, ha kézzel hozzáadom ezt az oszlopot a megfelelő típusú oszlopként.
A hiba: "pymysql.err.OperationalError: (1054, "Unknown column 'created' in 'field list'")"
Bővebben: 2022-06-26 18:25:38.154651 INFO Eon: Starting E.ON reader 2022-06-26 18:25:38.471035 INFO Eon: get verification token from E.ON portal 2022-06-26 18:25:38.780329 INFO Eon: Start receiving data 2022-06-26 18:25:38.907743 WARNING Eon: ------------------------------------------------------------ 2022-06-26 18:25:38.909524 WARNING Eon: Unexpected error in worker for App Eon: 2022-06-26 18:25:38.911161 WARNING Eon: Worker Ags: {'id': '2d39ab768cde4d9cb000eb5d9aea5d76', 'name': 'Eon', 'objectid': '6c7fb789c9c04bea8fd7fed8dc282c37', 'type': 'scheduler', 'function': <bound method Eon.read_data of <read_eon.Eon object at 0x747cc118>>, 'pin_app': True, 'pin_thread': 2, 'kwargs': {'interval': 18000, '__thread_id': 'thread-2'}} 2022-06-26 18:25:38.912758 WARNING Eon: ------------------------------------------------------------ 2022-06-26 18:25:38.916285 WARNING Eon: Traceback (most recent call last): File "/config/appdaemon/apps/eon/read_eon.py", line 243, in get_states cursor.execute(sql, (eon_type)) File "/usr/lib/python3.10/site-packages/pymysql/cursors.py", line 148, in execute result = self._query(query) File "/usr/lib/python3.10/site-packages/pymysql/cursors.py", line 310, in _query conn.query(q) File "/usr/lib/python3.10/site-packages/pymysql/connections.py", line 548, in query self._affected_rows = self._read_query_result(unbuffered=unbuffered) File "/usr/lib/python3.10/site-packages/pymysql/connections.py", line 775, in _read_query_result result.read() File "/usr/lib/python3.10/site-packages/pymysql/connections.py", line 1156, in read first_packet = self.connection._read_packet() File "/usr/lib/python3.10/site-packages/pymysql/connections.py", line 725, in _read_packet packet.raise_for_error() File "/usr/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error err.raise_mysql_exception(self._data) File "/usr/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception raise errorclass(errno, errval) pymysql.err.OperationalError: (1054, "Unknown column 'created' in 'field list'") During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/config/appdaemon/apps/eon/read_eon.py", line 247, in get_states self.log(f"Error - get_states: {err.message}", level="ERROR") AttributeError: 'OperationalError' object has no attribute 'message' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/appdaemon/threading.py", line 904, in worker funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"])) File "/config/appdaemon/apps/eon/read_eon.py", line 33, in read_data eon_1_8_0_report, eon_2_8_0_report = self.get_report_data(profile_data_url, session) File "/config/appdaemon/apps/eon/read_eon.py", line 120, in get_report_data self.collect_daily_data(eon_1_8_0_data, sensor_1_8_0_sensor, eon_1_8_0_report, "EON consumption energy total") File "/config/appdaemon/apps/eon/read_eon.py", line 142, in collect_daily_data rows = self.get_states(eon_sensor, extra_parameter) File "/config/appdaemon/apps/eon/read_eon.py", line 250, in get_states return rows UnboundLocalError: local variable 'rows' referenced before assignment 2022-06-26 18:25:38.918730 WARNING Eon: ------------------------------------------------------------