Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: DML failures in SQL Lab #25190

Merged
merged 4 commits into from
Sep 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions superset/sql_lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
Loading