rusackas opened a new pull request, #42787:
URL: https://github.com/apache/superset/pull/42787

   ### SUMMARY
   
   Discussion #40273 step 2 (SQLAlchemy 2.0 migration roadmap) added 
`cascade_backrefs=False` to seven models (`Query`, `SavedQuery`, `SqlaTable`, 
`SqlMetric`, `TableColumn`, `TaggedObject`, `User`) whose `backref()`-defined 
reverse relationships were triggering SQLAlchemy's "object is being merged into 
a Session along the backref cascade path" deprecation warning, locked in via a 
`pytest.ini` `filterwarnings` error line per model to prevent regression.
   
   A follow-up sweep for step 6 prep found three more models with the exact 
same pattern that the original sweep missed: `SSHTunnel.database`, 
`ReportRecipients.report_schedule`, and `ReportExecutionLog.report_schedule`. 
Same fix, same reasoning: in SQLAlchemy 2.0 this reverse cascade no longer 
happens automatically, so callers that relied on it implicitly would silently 
stop persisting these objects. Verified each caller already reaches the objects 
via an explicit `db.session.add()` or the forward collection assignment (which 
carries its own `cascade="all, delete-orphan"`, unaffected by 
`cascade_backrefs`), so nothing here depended on the removed behavior.
   
   ### TESTING INSTRUCTIONS
   
   ```
   SQLALCHEMY_WARN_20=1 pytest tests/unit_tests/databases/ssh_tunnel 
tests/unit_tests/reports tests/unit_tests/commands/report 
tests/unit_tests/daos/test_report_dao.py
   ```
   426 tests pass with the three new `pytest.ini` error lines active, 
confirming none of the exercised code paths still rely on the removed implicit 
cascade.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


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