dosubot[bot] commented on issue #29524: URL: https://github.com/apache/superset/issues/29524#issuecomment-2217315230
<!-- Greeting --> Hey there, @tooptoop4! I'm here to help you with any bugs, questions, or contributions. Just give me a shout if you need anything. <!-- Answer --> To resolve the "Error: no results to fetch" issue when using `SQL_QUERY_MUTATOR` with the statement `SET SESSION AUTHORIZATION <user>;`, you should set the `MUTATE_AFTER_SPLIT` configuration variable to `True`. This ensures that the `SQL_QUERY_MUTATOR` function is applied after the input query is split, allowing the `SET SESSION AUTHORIZATION` statement to be properly handled. Here's the relevant configuration snippet: ```python # A variable that chooses whether to apply the SQL_QUERY_MUTATOR before or after splitting the input query # It allows for using the SQL_QUERY_MUTATOR function for more than comments # Usage: If you want to apply a change to every statement to a given query, set MUTATE_AFTER_SPLIT = True # An example use case is if data has role based access controls, and you want to apply # a SET ROLE statement alongside every user query. Changing this variable maintains # functionality for both the SQL_Lab and Charts. MUTATE_AFTER_SPLIT = True ``` By setting `MUTATE_AFTER_SPLIT` to `True`, the `SQL_QUERY_MUTATOR` will be applied after the query is split, which should resolve the issue <sup>[[1]](https://github.com/apache/superset/blob/master/superset/config.py)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset/models/core.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* -- 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]
