bito-code-review[bot] commented on PR #43187:
URL: https://github.com/apache/superset/pull/43187#issuecomment-5297942560

   <!-- Bito Reply -->
   The flagged issue is correct. Calling `db_session.begin_nested()` triggers 
an implicit flush of all pending changes in the session, not just those within 
the new SAVEPOINT. If there are pending changes elsewhere (e.g., chart or 
dashboard updates), a failure in those unrelated changes will cause the 
`begin_nested()` call to fail, leaving the session in a broken state.
   
   To resolve this, you should ensure the session is clean before starting the 
nested transaction, or use a more granular approach to isolation. A common 
pattern is to flush only the specific changes you intend to protect, or to 
handle the session state explicitly before entering the `begin_nested()` block.
   
   Would you like me to fetch all other comments on this PR to validate them 
and implement a comprehensive fix?
   
   **superset/commands/importers/v1/utils.py**
   ```
   # Ensure no pending changes exist before starting the nested transaction
               db_session.flush()
               with db_session.begin_nested():
                   # ... existing logic ...
   ```


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