dabla commented on PR #41327:
URL: https://github.com/apache/airflow/pull/41327#issuecomment-2404127481
I have something weird going on with mysql integration tests, this PR has
changed anything (directly at least) related to MySQL:
Warnings saved into /files/warnings-operators-mysql.txt file.
=========================== short test summary info
============================
FAILED
tests/operators/test_generic_transfer.py::TestMySql::test_mysql_to_mysql[mysqlclient]
- MySQLdb.ProgrammingError: (1064, "You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right
syntax to use near 'schema, login, password, port, is_encrypted,
is_extra_encrypted, extra) VALUES (' at line 1")
FAILED
tests/operators/test_generic_transfer.py::TestMySql::test_mysql_to_mysql[mysql-connector-python]
- MySQLdb.ProgrammingError: (1064, "You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right
syntax to use near 'schema, login, password, port, is_encrypted,
is_extra_encrypted, extra) VALUES (' at line 1")
I've enabled logging of generated insert SQL statement used by the
insert_rows method in GenericTransfer:
INFO [airflow.task.hooks.airflow.providers.mysql.hooks.mysql.MySqlHook]
Generated sql: INSERT INTO test_mysql_to_mysql (id, conn_id, conn_type,
description, host, schema, login, password, port, is_encrypted,
is_extra_encrypted, extra) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
ERROR [airflow.task] Task failed with exception
Traceback (most recent call last):
File "/opt/airflow/airflow/models/taskinstance.py", line 761, in
_execute_task
result = _execute_callable(context=context, **execute_callable_kwargs)
File "/opt/airflow/airflow/models/taskinstance.py", line 727, in
_execute_callable
return ExecutionCallableRunner(
File "/opt/airflow/airflow/utils/operator_helpers.py", line 258, in run
return self.func(*args, **kwargs)
File "/opt/airflow/airflow/models/baseoperator.py", line 407, in wrapper
return func(self, *args, **kwargs)
File "/opt/airflow/airflow/operators/generic_transfer.py", line 108, in
execute
insert_rows(table=self.destination_table, rows=results,
**self.insert_args)
File "/opt/airflow/airflow/providers/common/sql/hooks/sql.py", line 696,
in insert_rows
cur.execute(sql, values)
File "/usr/local/lib/python3.9/site-packages/MySQLdb/cursors.py", line
179, in execute
res = self._query(mogrified_query)
File "/usr/local/lib/python3.9/site-packages/MySQLdb/cursors.py", line
330, in _query
db.query(q)
File "/usr/local/lib/python3.9/site-packages/MySQLdb/connections.py", line
261, in query
_mysql.connection.query(self, query)
MySQLdb.ProgrammingError: (1064, "You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right
syntax to use near 'schema, login, password, port, is_encrypted,
is_extra_encrypted, extra) VALUES (' at line 1")
INFO [airflow.models.taskinstance] Marking task as FAILED.
dag_id=unit_test_dag, task_id=test_m2m,
run_id=manual__2015-01-01T00:00:00+00:00, execution_date=20150101T000000,
start_date=20241009T190454, end_date=20241009T190454
The error makes sense as indeed "schema" is a reserved word and should be
escaped, but when looking in the MySQLHook I didn't find any code which escapes
column names in case it's a reserved word? So how come this suddenly starts
failing?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]