gabotorresruiz commented on code in PR #43883:
URL: https://github.com/apache/superset/pull/43883#discussion_r3961056264


##########
superset/models/helpers.py:
##########
@@ -3640,6 +3640,10 @@ def get_from_clause(
                     from_sql = parsed_script.format()
 
             except Exception as ex:  # pylint: disable=broad-except
+                # A caught DB error can leave db.session in "pending rollback"
+                # state, which would poison unrelated queries later in this 
request.
+                db.session.rollback()  # pylint: 
disable=consider-using-transaction

Review Comment:
   Just a small NIT, not a blocker: if the connection is broken enough that the 
rollback itself raises, that exception propagates out of this except block and 
replaces the fail-closed `QueryObjectValidationError` with a raw driver error. 
`get_query` in `sql_lab.py` wraps its recovery rollback in a try/except for 
exactly this reason; cheap insurance to do the same here.



-- 
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]

Reply via email to