Skip to content

Conversation

@KoenigMjr
Copy link
Contributor

Servus zusammen,

MySQL-Fehler wegen leerem Statement am Schluss von der DB_init Datei weil f.read().split(';') ja korrekterweise nach jedem ";" teilt. Jetzt schließt halt die init_db.sql-Datei mit...

[...]
	frequency varchar(30) not null
);
create unique index boswatch_id_uindex
	on boswatch (id);

ab

und f.read().split(';') macht zum Schluss (nach boswatch(id)) nochmal einen leeren String.

Mit der eingefügten Prüfung auf leere Strings wird das vermieden.

Im Anschluss nochmal der Error:

??? python[22805]: Traceback (most recent call last):
??? python[22805]:    File "/opt/boswatch3/venv/lib/python3.13/site-packages/mysql/connector/connection_cext.py", line 772, in cmd_query
??? python[22805]:       self._cmysql.query(
??? python[22805]:       ~~~~~~~~~~~~~~~~~~^
??? python[22805]:             query,
??? python[22805]:             ^^^^^^
??? python[22805]:       ...<3 lines>...
??? python[22805]:             query_attrs=self.query_attrs,
??? python[22805]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
??? python[22805]:       )
??? python[22805]:       ^
??? python[22805]: _mysql_connector.MySQLInterfaceError: Query was empty
??? python[22805]: The above exception was the direct cause of the following exception:
??? python[22805]: Traceback (most recent call last):
??? python[22805]:    File "/opt/boswatch3/bw_server.py", line 79, in <module>
??? python[22805]:       if not bwRoutMan.buildRouters(bwConfig):
??? python[22805]:              ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
??? python[22805]:    File "/opt/boswatch3/boswatch/router/routerManager.py", line 77, in buildRouters
??? python[22805]:       loadedClass = importedFile.BoswatchPlugin(routeConfig)
??? python[22805]:    File "/opt/boswatch3/plugin/mysql.py", line 35, in __init__
??? python[22805]:       super().__init__(__name__, config)  # you can access the config class on 'self.config'
??? python[22805]:       ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
??? python[22805]:    File "/opt/boswatch3/plugin/pluginBase.py", line 54, in __init__
??? python[22805]:       self.onLoad()
??? python[22805]:       ~~~~~~~~~~~^^
??? python[22805]:    File "/opt/boswatch3/plugin/mysql.py", line 60, in onLoad
??? python[22805]:       self.cursor.execute(stmnt)
??? python[22805]:       ~~~~~~~~~~~~~~~~~~~^^^^^^^
??? python[22805]:    File "/opt/boswatch3/venv/lib/python3.13/site-packages/mysql/connector/cursor_cext.py", line 353, in execute
??? python[22805]:       self._connection.cmd_query(
??? python[22805]:       ~~~~~~~~~~~~~~~~~~~~~~~~~~^
??? python[22805]:             self._stmt_partition["mappable_stmt"],
??? python[22805]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
??? python[22805]:       ...<2 lines>...
??? python[22805]:             raw_as_string=self._raw_as_string,
??? python[22805]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
??? python[22805]:       )
??? python[22805]:       ^
??? python[22805]:    File "/opt/boswatch3/venv/lib/python3.13/site-packages/mysql/connector/opentelemetry/context_propagation.py", line 97, in wrapper
??? python[22805]:       return method(cnx, *args, **kwargs)
??? python[22805]:    File "/opt/boswatch3/venv/lib/python3.13/site-packages/mysql/connector/connection_cext.py", line 781, in cmd_query
??? python[22805]:       raise get_mysql_exception(
??? python[22805]:             err.errno, msg=err.msg, sqlstate=err.sqlstate
??? python[22805]:       ) from err
??? python[22805]: mysql.connector.errors.ProgrammingError: 1065 (42000): Query was empty

Error:

??? python[22805]: Traceback (most recent call last):
??? python[22805]:    File "/opt/boswatch3/venv/lib/python3.13/site-packages/mysql/connector/connection_cext.py", line 772, in cmd_query
??? python[22805]:       self._cmysql.query(
??? python[22805]:       ~~~~~~~~~~~~~~~~~~^
??? python[22805]:             query,
??? python[22805]:             ^^^^^^
??? python[22805]:       ...<3 lines>...
??? python[22805]:             query_attrs=self.query_attrs,
??? python[22805]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
??? python[22805]:       )
??? python[22805]:       ^
??? python[22805]: _mysql_connector.MySQLInterfaceError: Query was empty
??? python[22805]: The above exception was the direct cause of the following exception:
??? python[22805]: Traceback (most recent call last):
??? python[22805]:    File "/opt/boswatch3/bw_server.py", line 79, in <module>
??? python[22805]:       if not bwRoutMan.buildRouters(bwConfig):
??? python[22805]:              ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
??? python[22805]:    File "/opt/boswatch3/boswatch/router/routerManager.py", line 77, in buildRouters
??? python[22805]:       loadedClass = importedFile.BoswatchPlugin(routeConfig)
??? python[22805]:    File "/opt/boswatch3/plugin/mysql.py", line 35, in __init__
??? python[22805]:       super().__init__(__name__, config)  # you can access the config class on 'self.config'
??? python[22805]:       ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
??? python[22805]:    File "/opt/boswatch3/plugin/pluginBase.py", line 54, in __init__
??? python[22805]:       self.onLoad()
??? python[22805]:       ~~~~~~~~~~~^^
??? python[22805]:    File "/opt/boswatch3/plugin/mysql.py", line 60, in onLoad
??? python[22805]:       self.cursor.execute(stmnt)
??? python[22805]:       ~~~~~~~~~~~~~~~~~~~^^^^^^^
??? python[22805]:    File "/opt/boswatch3/venv/lib/python3.13/site-packages/mysql/connector/cursor_cext.py", line 353, in execute
??? python[22805]:       self._connection.cmd_query(
??? python[22805]:       ~~~~~~~~~~~~~~~~~~~~~~~~~~^
??? python[22805]:             self._stmt_partition["mappable_stmt"],
??? python[22805]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
??? python[22805]:       ...<2 lines>...
??? python[22805]:             raw_as_string=self._raw_as_string,
??? python[22805]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
??? python[22805]:       )
??? python[22805]:       ^
??? python[22805]:    File "/opt/boswatch3/venv/lib/python3.13/site-packages/mysql/connector/opentelemetry/context_propagation.py", line 97, in wrapper
??? python[22805]:       return method(cnx, *args, **kwargs)
??? python[22805]:    File "/opt/boswatch3/venv/lib/python3.13/site-packages/mysql/connector/connection_cext.py", line 781, in cmd_query
??? python[22805]:       raise get_mysql_exception(
??? python[22805]:             err.errno, msg=err.msg, sqlstate=err.sqlstate
??? python[22805]:       ) from err
??? python[22805]: mysql.connector.errors.ProgrammingError: 1065 (42000): Query was empty
Copy link
Member

@Schrolli91 Schrolli91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Schrolli91 Schrolli91 merged commit 71fc7c5 into BOSWatch:develop Nov 26, 2025
5 checks passed
@KoenigMjr KoenigMjr deleted the bugfix/mysql branch November 26, 2025 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants