bito-code-review[bot] commented on code in PR #44835:
URL: https://github.com/apache/superset/pull/44835#discussion_r4162262579


##########
superset/semantic_layers/models.py:
##########
@@ -700,7 +718,18 @@ def data_for_slices(self, slices: list[Any]) -> 
ExplorableData:
         return self.data
 
     def get_extra_cache_keys(self, query_obj: QueryObjectDict) -> 
list[Hashable]:
-        return []
+        token: str | None = self.metadata_cache_token
+        return [token] if token is not None else []

Review Comment:
   <!-- Bito Reply -->
   The suggestion to handle `MetadataRefreshError` in `get_extra_cache_keys` is 
appropriate. Since `metadata_cache_token` can raise this error when 
configuration or budget constraints are met, propagating it unhandled causes 
chart queries to fail during cache-key computation. Translating this error into 
a handled state or returning an empty list (or a default value) would prevent 
the query from failing prematurely.
   
   **superset/semantic_layers/models.py**
   ```
   def get_extra_cache_keys(self, query_obj: QueryObjectDict) -> list[Hashable]:
           try:
               token: str | None = self.metadata_cache_token
               return [token] if token is not None else []
           except MetadataRefreshError:
               return []
   ```



-- 
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]

Reply via email to