This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new d8496425e2 fix: DML failures in SQL Lab (#25190)
d8496425e2 is described below

commit d8496425e26449b4519bc3afac7be3db2434a7fd
Author: Hugh A. Miles II <[email protected]>
AuthorDate: Wed Sep 6 14:41:36 2023 +0200

    fix: DML failures in SQL Lab (#25190)
---
 superset/sql_lab.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/superset/sql_lab.py b/superset/sql_lab.py
index cb8da3ef04..196b48b1d2 100644
--- a/superset/sql_lab.py
+++ b/superset/sql_lab.py
@@ -217,6 +217,7 @@ def execute_sql_statement(  # pylint: 
disable=too-many-arguments,too-many-statem
         )
 
     sql = parsed_query.stripped()
+
     # This is a test to see if the query is being
     # limited by either the dropdown or the sql.
     # We are testing to see if more rows exist than the limit.
@@ -512,8 +513,13 @@ def execute_sql_statements(
                     ex, query, session, payload, prefix_message
                 )
                 return payload
-        # Commit the connection so CTA queries will create the table.
-        if apply_ctas:
+
+        # Commit the connection so CTA queries will create the table and any 
DML.
+        should_commit = (
+            not db_engine_spec.is_select_query(parsed_query)  # check if query 
is DML
+            or apply_ctas
+        )
+        if should_commit:
             conn.commit()
 
     # Success, updating the query entry in database

Reply via email to