You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "hy144328 (via GitHub)" <gi...@apache.org> on 2026/07/23 21:08:38 UTC
[PR] chore: SQLAlchemy User cascade backref warnings are irrelevant [superset]
hy144328 opened a new pull request, #42360:
URL: https://github.com/apache/superset/pull/42360
<!---
Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
Example:
fix(dashboard): load charts correctly
-->
See #40273 .
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
This PR addresses the warnings thrown by SQLAlchemy 1.4 because the `User` and `Role` models do not explicit declare `cascade_backrefs=False` in agreement with SQLAlchemy 2.0.
For completeness, the respective warning/error type is removed from `pytest.ini` although there is no code change:
* The `cascade_backrefs` parameter is _not_ set to `False` in the `User` and `Role` models they are in the Flask Appbuilder library and not part of the codebase.
My IDE tells me that, within Flask Appbuilder, there is only [one location](https://github.com/dpgaspar/Flask-AppBuilder/blob/55a5ab67348b3249a78e9bbbf817e320c20b81dd/flask_appbuilder/security/sqla/apis/user/api.py#L126) where a `User` object is created (and not queried from the database).
This `User` object is explicitly added to the SQLAlchemy session [a few lines later](https://github.com/dpgaspar/Flask-AppBuilder/blob/55a5ab67348b3249a78e9bbbf817e320c20b81dd/flask_appbuilder/security/sqla/apis/user/api.py#L167).
So Flask Appbuilder should not block the next step of activating the `Session` object `future` flag.
* I manually checked the 110 or so call sites in the Superset codebase.
`User` plays a hybrid role of (i) being the DTO corresponding to the user relation in the database, and (ii) representing the user in the IAM of Flask.
From what I see, in the SQLAlchemy case, `User` is already explicitly added to the SQLAlchemy session, sometimes indirectly via `UserDAO.create()`.
In the Flask case, it is most often passed to the `override_user` context manager, and does not have to be persisted.
* I completely removed the warning/error class from `pytest.ini`, similarly to #41977 and #41982.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
Because the code has not been altered, and no new warnings are converted to errors, we do not expect any tests to fail.
This is not a problem because the official documentation suggests the alternative of setting `Session.future`, which is the next step in the roadmap anyways. #40273
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] 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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] chore: SQLAlchemy User cascade backref warnings are irrelevant [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #42360:
URL: https://github.com/apache/superset/pull/42360#issuecomment-5063451508
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] chore: SQLAlchemy User cascade backref warnings are irrelevant [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #42360:
URL: https://github.com/apache/superset/pull/42360
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org