Bug description

see https://github.com/apache/superset/pull/21645#issuecomment-1493816027 for more details

How to reproduce the bug

see https://github.com/apache/superset/pull/21645#issuecomment-1493816027 for more details

Screenshots/recordings

No response

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Chrome

Additional context

No response

Checklist

  • [ ] I have searched Superset docs and Slack and didn't find a solution to my problem.
  • [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
  • [ ] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Comment From: dosubot[bot]

Hey there, @tooptoop4! I'm here to help you with any bugs, questions, or contributions. Just give me a shout if you need anything.

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:

# 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 [1][2].

To continue talking to Dosu, mention @dosu.

Comment From: rusackas

Are you still facing this? I'm honestly not sure what to make of it, and I doubt others are either... the comments on merged PRs are a bit confusing, and I'm not sure if there's an easy way to re-state the issue and how we can best reproduce it.

Comment From: tooptoop4

still facing issue using SQL_QUERY_MUTATOR of 'SET SESSION AUTHORIZATION someuser;' on redshift

Comment From: rusackas

Do you think it's redshift specific? Is it still happening as of the 5.0.0 release?