LucasWolke commented on code in PR #34111:
URL: https://github.com/apache/superset/pull/34111#discussion_r2202043533
##########
superset/sql_lab.py:
##########
@@ -475,7 +475,9 @@ def execute_sql_statements( # noqa: C901
db.session.commit()
# Hook to allow environment-specific mutation (usually comments)
to the SQL
- query.executed_sql = database.mutate_sql_based_on_config(block)
+ query.executed_sql = database.mutate_sql_based_on_config(
+ block, is_split=config["MUTATE_AFTER_SPLIT"]
Review Comment:
The sql lab shouldn't even be using the `mutate_sql_based_on_config` method,
it always wants to mutate the sql.
I think the confusion comes from a refactor you did
[here](https://github.com/apache/superset/commit/cfc440c56cb973bd3202ab8d7daabbbde888704a#diff-a0173518300cdfa4526b24e65fb23e7b77acc76a9b4c5983d581759028b4dbdbL267-R266).
``` diff
- sql = SQL_QUERY_MUTATOR(
- sql,
- security_manager=security_manager,
- database=database,
- )
+ sql = database.mutate_sql_based_on_config(sql)
```
The sql lab was refactored to use `mutate_sql_based_on_config`, but that
method was only written for a fix in chart queries (#21645) . In the sql lab we
don't care about `is_split`.
I propose that we either create a new `mutate_sql` function that always
mutates or just use the mutator like before the refactor.
Again, we don't want to use the before or after split logic, that was never
intended for the sql lab. Hope this makes more sense now.
--
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]