You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/02/25 06:42:50 UTC

[GitHub] [superset] zhaoyongjie commented on issue #18937: Implement a Jinja macro to retrieve Dashboard's JSON metadata

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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org