zhaoyongjie commented on issue #18937:
URL: https://github.com/apache/superset/issues/18937#issuecomment-1050571606
Hi @EBoisseauSierra, there is a more general and secure way to modify the
query generation logic from `config.py`. like this:
```python
def get_query_str_extended(self, query_obj: QueryObjectDict) ->
QueryStringExtended:
new_query_obj = mutate_query_object_from_config(query_obj,
user_object, security_manager, etc...) <----- append filter into query_obj
sqlaq = self.get_sqla_query(**new_query_obj)
sql = self.database.compile_sqla_query(sqlaq.sqla_query)
sql = self._apply_cte(sql, sqlaq.cte)
sql = sqlparse.format(sql, reindent=True)
sql = self.mutate_query_from_config(sql)
return QueryStringExtended(
applied_template_filters=sqlaq.applied_template_filters,
labels_expected=sqlaq.labels_expected,
prequeries=sqlaq.prequeries,
sql=sql,
)
```
--
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]