mikebridge commented on PR #39977:
URL: https://github.com/apache/superset/pull/39977#issuecomment-4452760921

   > @richardfogaca I think there's a better solution to the 
`raise_for_ownership` issue, which is to always supply the "skip" filter 
there---there's no logical reason to be omitting soft-deleted items in "check 
owners". That eliminates a lot of the complexity of this PR
   
   I'm seeing that my "better solution" is actually more of a whack-a-mole 
thing because there are several more places where `execution_options` is 
insufficient for propagating the "include soft-deletion" flag.  The general 
problem is that any code path that constructs a new Query from the model class 
— without taking the bypass option as an explicit parameter — won't inherit the 
flag. The confirmed instance is `Flask-AppBuilder`'s 
`SQLAInterface.get_outer_query_from_inner_query`: when list_columns contains 
many-to-many fields, the outer fetch query is built from a fresh 
`session.query(self.obj)` and joined to the filtered query as a `.subquery()` 
Core construct — at which point the bypass option (which lived on the filtered 
inner Query) is gone. The listener fires on the outer query, sees no bypass, 
attaches its `with_loader_criteria(where_not_deleted)`, and the result query 
collides with the inner subquery's filter and returns zero rows. Other 
framework or future code paths c
 ould lose the option the same way; auditing all of them isn't realistic.
   
   Either I have to fix all these cases individually ("if flag is on original 
then add flag to subquery...") and _hope_ that I catch them all, or else make 
the flag ambient in either the request or the session.  I'm leaning towards 
doing it in the session.


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