hetz commented on issue #9683:
URL: https://github.com/apache/superset/issues/9683#issuecomment-3227720477

   
   Thanks for reporting this issue.
   
   To apply a temporary fix, you can patch the SQLAlchemy `default.py` file 
inside the `superset_app` container to conditionally skip the `rollback()` call 
when connecting to a specific MySQL port (e.g., 3307). This is useful in 
scenarios where the underlying database (like some MySQL setups) does not 
expect or properly handle explicit rollback calls.
   
   You can apply the patch and restart the container using the following 
commands:
   
   ```bash
   docker exec -i superset_app bash <<'EOF'
   sed -i."$(date +%Y%m%d_%H%M%S)_bak" '/def do_rollback(self, 
dbapi_connection):/{
       N
       s/dbapi_connection\.rollback()/\
   try:\\n    if getattr(dbapi_connection, "port", None) == 3307:\\n        
return\\nexcept Exception:\\n    pass\\n    dbapi_connection.rollback()/
   }' /app/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py
   EOF
   
   docker restart superset_app
   ```
   
   **Explanation:**
   - The `sed` command creates a timestamped backup of the original file.
   - It modifies the `do_rollback` method to skip calling `rollback()` if the 
connection's port is 3307 (commonly used for certain MySQL proxies or read 
replicas).
   - This change is ephemeral and will be lost if the container is rebuilt, so 
consider baking this into a custom image for production use.
   
   > ⚠️ **Note**: Modifying files inside a running container is not recommended 
for production environments. This workaround is intended for testing or 
temporary mitigation. A more robust solution would involve upgrading 
SQLAlchemy, patching the application, or adjusting the database driver behavior.
   


-- 
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: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to