Open dmarkey opened 2 months ago
The SQL_QUERY_MUTATOR
function is not called in SQLab when MUTATE_AFTER_SPLIT = True
because the condition for calling the mutator function checks if the is_split
parameter matches the MUTATE_AFTER_SPLIT
configuration. If MUTATE_AFTER_SPLIT
is set to True
, the mutator function will only be called after the SQL is split into smaller queries. If the SQL is not split, the condition will not be met, and the mutator function will not be called.
Here is the relevant code snippet:
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_
In this code, is_split
must be True
for the mutator to be called when MUTATE_AFTER_SPLIT
is True
. If is_split
is False
, the mutator will not be invoked [1][2].
To continue talking to Dosu, mention @dosu.
Bug description
SQL_QUERY_MUTATOR
function is not called for queries in SQLab whenMUTATE_AFTER_SPLIT = True
Simply not called, but is called when
MUTATE_AFTER_SPLIT = False
How to reproduce the bug
config.py:
Navigate to SQLLab and do some queries.. see nothing printed..
Go to a chart and see the print message.
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.9
Node version
18 or greater
Browser
Chrome
Additional context
No response
Checklist