aminghadersohi commented on code in PR #45232:
URL: https://github.com/apache/superset/pull/45232#discussion_r4278081965
##########
superset/sql/execution/celery_task.py:
##########
@@ -481,15 +484,23 @@ def _execute_sql_statements(
)
) from ex
- # Check if stopped
- if not execution_results:
- payload.update({"status": QueryStatus.STOPPED.value})
- return payload
+ # Cancelling can clear cursor.description, leaving a nonempty result
+ # list that looks like successful DML. Check intent, not just results.
+ stopped = not execution_results or check_stopped()
# Commit for mutations
- if parsed_script.has_mutation() or query.select_as_cta:
+ if not stopped and (parsed_script.has_mutation() or
query.select_as_cta):
Review Comment:
Remaining: the sync SQL Lab path (superset/sql_lab.py:632) still commits a
stopped UPDATE/CTAS when the stop lands after the last block; an independent
check at 758e87f60fa44f24e8d7297aa61a4cfb3d4bf28c confirmed that. This PR does
not change that path. The fix (re-read the status just before the commit and
skip it when a stop is recorded) is in
https://github.com/apache/superset/pull/45283 at commit
dd5670cc8185700a68384ee8171ae0940c64a20c, with
tests/unit_tests/sql_lab_test.py::test_get_sql_results_stop_before_target_commit_stays_stopped.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]