Bug description

Accessing a mysql db with MysqlConnector, we received mysql error: No result set to fetch from when we try to do an insert, create, update.

The same statement work with the mysqldb python module, but we need the caching_sha2_password option, i can not use it anymore in real life.

Screenshots/recordings

Image

Superset version

4.1.2

Python version

3.11

Node version

I don't know

Browser

Chrome

Additional context

superset_app | 2025-07-17 15:35:10,963:DEBUG:superset.sql_parse:Parsing with sqlparse statement: INSERT INTO yves_tst values ( 5 ) superset_app | 2025-07-17 15:35:10,970:DEBUG:root:Query 34414: Running query: INSERT INTO yves_tst values ( 5 ) superset_app | 2025-07-17 15:35:10,971:DEBUG:superset.sql_parse:Parsing with sqlparse statement: INSERT INTO yves_tst values ( 5 ) superset_app | 2025-07-17 15:35:10,973:DEBUG:root:Query 34414: Handling cursor superset_app | 2025-07-17 15:35:10,973:DEBUG:superset.stats_logger:[stats_logger] (timing) sqllab.query.time_executing_query | 5.1240234375 superset_app | 2025-07-17 15:35:10,974:DEBUG:superset.sql_lab:Query 34414: Fetching data for query object: {'changed_on': '2025-07-17T15:35:10.965779', 'dbId': 65, 'db': 'MySQL', 'endDttm': None, 'errorMessage': None, 'executedSql': 'INSERT INTO yves_tst values ( 5 )', 'id': 'WxvM8Ntcx5A', 'queryId': 34414, 'limit': 1000, 'limitingFactor': , 'progress': 0, 'rows': None, 'catalog': None, 'schema': 'duproprio', 'ctas': False, 'serverId': 34414, 'sql': 'INSERT INTO yves_tst values ( 5 )', 'sqlEditorId': '785', 'startDttm': Decimal('1752766510674.381000'), 'state': 'running', 'tab': 'Untitled Query 1', 'tempSchema': None, 'tempTable': None, 'userId': 2, 'user': "Yves D'Astous", 'resultsKey': None, 'trackingUrl': None, 'extra': {'cancel_query': 788986, 'progress': 'Running statement 1 out of 1'}} superset_app | 2025-07-17 15:35:10,974:DEBUG:superset.stats_logger:[stats_logger] (timing) sqllab.query.time_fetching_results | 1.27099609375 superset_app | 2025-07-17 15:35:10,975:DEBUG:superset.sql_lab:Query 34414: No result set to fetch from superset_app | 2025-07-17 15:35:10,991:DEBUG:superset.stats_logger:[stats_logger] (incr) SqlLabRestApi.execute_sql_query.error superset_app | 2025-07-17 15:35:10,991:WARNING:superset.views.error_handling:SupersetErrorsException superset_app | Traceback (most recent call last): superset_app | File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request superset_app | rv = self.dispatch_request() superset_app | ^^^^^^^^^^^^^^^^^^^^^^^ superset_app | File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request superset_app | return self.ensure_sync(self.view_functions[rule.endpoint])(view_args) superset_app | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ superset_app | File "/usr/local/lib/python3.11/site-packages/flask_appbuilder/security/decorators.py", line 95, in wraps superset_app | return f(self, *args, kwargs) superset_app | ^^^^^^^^^^^^^^^^^^^^^^^^ superset_app | File "/app/superset/views/base_api.py", line 119, in wraps superset_app | duration, response = time_function(f, self, args, kwargs) superset_app | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ superset_app | File "/app/superset/utils/core.py", line 1364, in time_function superset_app | response = func(args, kwargs) superset_app | ^^^^^^^^^^^^^^^^^^^^^ superset_app | File "/app/superset/views/base_api.py", line 91, in wraps superset_app | return f(self, *args, kwargs) superset_app | ^^^^^^^^^^^^^^^^^^^^^^^^ superset_app | File "/app/superset/utils/log.py", line 303, in wrapper superset_app | value = f(args, kwargs) superset_app | ^^^^^^^^^^^^^^^^^^ superset_app | File "/app/superset/sqllab/api.py", line 409, in execute_sql_query superset_app | command_result: CommandResult = command.run() superset_app | ^^^^^^^^^^^^^ superset_app | File "/app/superset/utils/decorators.py", line 266, in wrapped superset_app | return on_error(ex) superset_app | ^^^^^^^^^^^^ superset_app | File "/app/superset/utils/decorators.py", line 236, in on_error superset_app | raise ex superset_app | File "/app/superset/utils/decorators.py", line 259, in wrapped superset_app | result = func(args, **kwargs) superset_app | ^^^^^^^^^^^^^^^^^^^^^ superset_app | File "/app/superset/commands/sql_lab/execute.py", line 105, in run superset_app | status = self._run_sql_json_exec_from_scratch() superset_app | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ superset_app | File "/app/superset/commands/sql_lab/execute.py", line 158, in _run_sql_json_exec_from_scratch superset_app | return self._sql_json_executor.execute(

Checklist

  • [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
  • [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
  • [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Comment From: dosubot[bot]

Hi @ydastous! I'm Dosu and I’m helping the superset team.

This error is due to a compatibility mismatch between Superset's result-fetching logic and how the mysql-connector-python driver signals result set availability for DDL/DML statements like INSERT, CREATE, or UPDATE. Superset expects the driver to properly indicate when a statement does not return a result set, but mysql-connector-python sometimes does not, leading to the "No result set to fetch from" error. Other drivers, like mysqldb, handle this signaling differently, which is why you don't see the error there. This is a known class of compatibility issues with mysql-connector-python in Superset, but there is no documented workaround or configuration to resolve it as of 4.1.2 reference reference.

If you require caching_sha2_password and cannot use mysqldb, you may need to monitor for upstream fixes or consider alternative approaches, as Superset's MySQL engine spec does not currently have special handling for this error with mysql-connector-python.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

Comment From: ydastous

Hello @dosu is there a list of other drivers i can try with mysql ?

Yves

On Thu, Jul 17, 2025 at 11:42 AM dosubot[bot] @.***> wrote:

dosubot[bot] left a comment (apache/superset#34208) https://github.com/apache/superset/issues/34208#issuecomment-3084551213

Hi @ydastous https://github.com/ydastous! I'm Dosu https://go.dosu.dev/dosubot and I’m helping the superset team.

This error is due to a compatibility mismatch between Superset's result-fetching logic and how the mysql-connector-python driver signals result set availability for DDL/DML statements like INSERT, CREATE, or UPDATE. Superset expects the driver to properly indicate when a statement does not return a result set, but mysql-connector-python sometimes does not, leading to the "No result set to fetch from" error. Other drivers, like mysqldb, handle this signaling differently, which is why you don't see the error there. This is a known class of compatibility issues with mysql-connector-python in Superset, but there is no documented workaround or configuration to resolve it as of 4.1.2 reference https://github.com/apache/superset/issues/33855 reference https://github.com/apache/superset/issues/33157.

If you require caching_sha2_password and cannot use mysqldb, you may need to monitor for upstream fixes or consider alternative approaches, as Superset's MySQL engine spec does not currently have special handling for this error with mysql-connector-python.

To reply, just mention @dosu https://go.dosu.dev/dosubot.

How did I do? Good https://app.dosu.dev/response-feedback/5c75e684-e2c9-41c2-aa13-f125ba0940ee?feedback_type=great_response | Irrelevant https://app.dosu.dev/response-feedback/5c75e684-e2c9-41c2-aa13-f125ba0940ee?feedback_type=irrelevant_answer | Incorrect https://app.dosu.dev/response-feedback/5c75e684-e2c9-41c2-aa13-f125ba0940ee?feedback_type=incorrect_sources | Verbose https://app.dosu.dev/response-feedback/5c75e684-e2c9-41c2-aa13-f125ba0940ee?feedback_type=too_verbose | Hallucination https://app.dosu.dev/response-feedback/5c75e684-e2c9-41c2-aa13-f125ba0940ee?feedback_type=hallucination | Report 🐛 https://app.dosu.dev/response-feedback/5c75e684-e2c9-41c2-aa13-f125ba0940ee?feedback_type=bug_report | Other https://app.dosu.dev/response-feedback/5c75e684-e2c9-41c2-aa13-f125ba0940ee?feedback_type=other [image: Join Discord] https://go.dosu.dev/discord-bot [image: Share on X] https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/34208

— Reply to this email directly, view it on GitHub https://github.com/apache/superset/issues/34208#issuecomment-3084551213, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADFBC5ZIABGW7PIPFQIHDID3I677JAVCNFSM6AAAAACBYGX73WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTAOBUGU2TCMRRGM . You are receiving this because you were mentioned.Message ID: @.***>

Comment From: dosubot[bot]

Superset officially supports two MySQL drivers: mysqlclient (the default, also known as mysqldb) and mysql-connector-python. mysqlclient is recommended for most cases, but it does not support the caching_sha2_password authentication plugin used by newer MySQL servers. If you need caching_sha2_password, you should use mysql-connector-python instead. Both drivers are supported for basic SQL operations, but as you've seen, there are known issues with DDL/DML result set handling in mysql-connector-python docs.

PyMySQL is mentioned in some community discussions as a possible alternative (connection string: mysql+pymysql://user:password@host:port/dbname), but it is not officially documented or supported by Superset, and its compatibility—especially with authentication plugins and DDL/DML handling—may be limited discussion.

No other MySQL drivers are officially recognized or documented as supported by Superset for MySQL connections. If you need caching_sha2_password, mysql-connector-python is the main supported option, despite its current limitations with DDL/DML in Superset docs.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

Comment From: ydastous

At this point i will close this ticket since no solution is working for me, The superset doc about de database driver should be update to reflect the fact about known issues with DDL/DML result set handling in mysql-connector-python.