hy144328 commented on code in PR #42210:
URL: https://github.com/apache/superset/pull/42210#discussion_r3614444832
##########
superset/security/manager.py:
##########
@@ -3703,7 +3703,11 @@ def raise_for_access( # noqa: C901
client_id=shortid()[:10],
user_id=get_user_id(),
)
- self.session.expunge(query)
+ # This ephemeral Query must never be persisted; with
+ # cascade_backrefs=False it is not added to the session in the
+ # first place, so only expunge if something else added it.
+ if query in self.session:
Review Comment:
I find this guard a good idea.
It mirrors the guard in
https://github.com/apache/superset/blob/7e63b29741a392bb3be92e77a883894f629579d9/superset/models/core.py#L759
.
##########
superset/security/manager.py:
##########
@@ -3703,7 +3703,11 @@ def raise_for_access( # noqa: C901
client_id=shortid()[:10],
user_id=get_user_id(),
)
- self.session.expunge(query)
+ # This ephemeral Query must never be persisted; with
Review Comment:
I do not fully understand if the concept of ephemeral queries is part of the
database model.
But from a technical standpoint, this looks fine.
--
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]