LucasWolke opened a new pull request, #34111: URL: https://github.com/apache/superset/pull/34111
<!--- Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/ Example: fix(dashboard): load charts correctly --> ### SUMMARY <!--- Describe the change below, including rationale and design decisions --> Very simple fix for bug described in: #30169 Currently all queries in sqllab are mutated like this: `query.executed_sql = database.mutate_sql_based_on_config(block)` ``` def mutate_sql_based_on_config(self, sql_: str, is_split: bool = False) -> str: sql_mutator = config["SQL_QUERY_MUTATOR"] if sql_mutator and (is_split == config["MUTATE_AFTER_SPLIT"]): return sql_mutator( sql_, security_manager=security_manager, database=self, ) return sql_ ``` This means `is_split` is always `False` -> We always use the sql_mutator when `MUTATE_AFTER_SPLIT` is False, and never when it's True. The fix passes the value of `MUTATE_AFTER_SPLIT` to the `mutate_sql_based_on_config` function, so `is_split == config["MUTATE_AFTER_SPLIT"]` always evaluates to True. This does not break current implementations and fix the bug. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF <!--- Skip this if not applicable --> ### TESTING INSTRUCTIONS In config.py: ``` MUTATE_AFTER_SPLIT = True def SQL_QUERY_MUTATOR( # pylint: disable=invalid-name,unused-argument sql: str, **kwargs ) -> str: print("Query mutator called") ## will now print during SQLab sessions return sql ``` Run query in sql lab -> Now prints message when `MUTATE_AFTER_SPLIT` = True or False ### ADDITIONAL INFORMATION Fixes #30169 - [x] Has associated issue: #30169 - [ ] 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 - [ ] 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]
