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 2019/08/27 19:04:05 UTC

[GitHub] [incubator-superset] villebro commented on a change in pull request #8128: Add check for calls to cache_key_wrapper

villebro commented on a change in pull request #8128: Add check for calls to cache_key_wrapper
URL: https://github.com/apache/incubator-superset/pull/8128#discussion_r318247117
 
 

 ##########
 File path: superset/connectors/sqla/models.py
 ##########
 @@ -1064,9 +1065,31 @@ def query_datasources_by_name(cls, session, database, datasource_name, schema=No
     def default_query(qry):
         return qry.filter_by(is_sqllab_view=False)
 
+    def has_extra_cache_keys(self, query_obj: Dict) -> bool:
+        """
+        Detects the presence of calls to cache_key_wrapper in items in query_obj that can
+        be templated.
+
+        :param query_obj: query object to analyze
+        :return: True if at least one item calls cache_key_wrapper, otherwise False
+        """
+        regex = re.compile(r"\{\{.*cache_key_wrapper\(.*\).*\}\}")
+        templatable_statements: List[str] = []
+        templatable_statements.append(self.sql)
+        extras = query_obj.get("extras", {})
 
 Review comment:
   No, for now just these four (you can search for `template_processor.process_template`). Will try to think about a more elegant solution.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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