solanksh opened a new pull request, #21645:
URL: https://github.com/apache/superset/pull/21645

   feat(charts): allow query mutator to update queries after splitting original 
sql
   
   ### SUMMARY
   The changes allow a user to use the SQL_QUERY_MUTATOR function to add 
statements such as SET ROLE without breaking functionality. Currently, adding a 
statemen like this works fine in the SQL Editor, but Charts run individual 
statements by splitting a passed query and throw errors since SET ROLE does not 
return any data on its own. With the new MUTATE_AFTER_SPLIT variable, users can 
choose to apply the mutator function after the chart's query execution function 
splits a given query, allowing users to apply a change to all statements in a 
query and have Chart functionality not be interrupted.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   ### TESTING INSTRUCTIONS
   In the config file, update the SQL_QUERY_MUTATOR function to add a statement 
which does not return any results on its own and is something which should be 
run alongside all other statements in a given query. An example of this is 
adding a SET ROLE statement to the beginning of a query. Create a new Chart and 
see if queries return errors due to no data being fetched. Now in the config 
file, add a MUTATE_AFTER_SPLIT variable and set it equal to True. Create a new 
Chart and make a query, and verify that the desired results are showing.
   
   ### 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
   - [X ] 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: [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