villebro commented on a change in pull request #13255:
URL: https://github.com/apache/superset/pull/13255#discussion_r580009154



##########
File path: superset/connectors/sqla/models.py
##########
@@ -900,20 +924,40 @@ def get_sqla_query(  # pylint: 
disable=too-many-arguments,too-many-locals,too-ma
         order_desc: bool = True,
     ) -> SqlaQuery:
         """Querying any sqla table from this common interface"""
-        template_kwargs = {
-            "from_dttm": from_dttm.isoformat() if from_dttm else None,
-            "groupby": groupby,
-            "metrics": metrics,
-            "row_limit": row_limit,
-            "row_offset": row_offset,
-            "to_dttm": to_dttm.isoformat() if to_dttm else None,
-            "filter": filter,
-            "columns": [col.column_name for col in self.columns],
-        }
-        template_kwargs.update(self.template_params_dict)
+
         extra_cache_keys: List[Any] = []
-        template_kwargs["extra_cache_keys"] = extra_cache_keys
+        is_sip_38 = is_feature_enabled("SIP_38_VIZ_REARCHITECTURE")

Review comment:
       This feature flag has been removed a while ago, so you probably need to 
double check that all changes here are still relevant.

##########
File path: superset/connectors/sqla/models.py
##########
@@ -877,6 +878,29 @@ def _get_sqla_row_level_filters(
                 _("Error in jinja expression in RLS filters: %(msg)s", 
msg=ex.message,)
             )
 
+    def _get_template_kwargs(  # pylint:disable = too-many-arguments
+        self,
+        metrics: List[Metric],
+        extra_cache_keys: List[Any],
+        filter_: Optional[List[Dict[str, Any]]] = None,
+        from_dttm: Optional[datetime] = None,
+        to_dttm: Optional[datetime] = None,
+        groupby: Optional[List[str]] = None,
+        row_limit: Optional[int] = None,
+        row_offset: Optional[int] = None,
+    ) -> Dict[str, Any]:
+        return {
+            "from_dttm": from_dttm.isoformat() if from_dttm else None,
+            "groupby": groupby,
+            "metrics": metrics,
+            "row_limit": row_limit,
+            "row_offset": row_offset,
+            "to_dttm": to_dttm.isoformat() if to_dttm else None,
+            "filter": filter_,
+            "columns": [col.column_name for col in self.columns],
+            "extra_cache_keys": extra_cache_keys,
+        }
+

Review comment:
       Would it make sense to combine `_get_template_kwargs` and 
`update_template_kwargs` into one function in `sql_query_utils.py`?




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to