MCPcopy
hub / github.com/apache/superset / get_payload

Method get_payload

superset/common/query_context.py:299–323  ·  view source on GitHub ↗

Returns the query results with both metadata and data

(
        self, cache_query_context: Optional[bool] = False, force_cached: bool = False,
    )

Source from the content-addressed store, hash-verified

297 return df.to_dict(orient="records")
298
299 def get_payload(
300 self, cache_query_context: Optional[bool] = False, force_cached: bool = False,
301 ) -> Dict[str, Any]:
302 """Returns the query results with both metadata and data"""
303
304 # Get all the payloads from the QueryObjects
305 query_results = [
306 get_query_results(
307 query_obj.result_type or self.result_type, self, query_obj, force_cached
308 )
309 for query_obj in self.queries
310 ]
311 return_value = {"queries": query_results}
312
313 if cache_query_context:
314 cache_key = self.cache_key()
315 set_and_log_cache(
316 cache_manager.cache,
317 cache_key,
318 {"data": self.cache_values},
319 self.cache_timeout,
320 )
321 return_value["cache_key"] = cache_key # type: ignore
322
323 return return_value
324
325 @property
326 def cache_timeout(self) -> int:

Callers 8

queryMethod · 0.95
generate_jsonMethod · 0.45
annotation_jsonMethod · 0.45
explore_jsonMethod · 0.45
warm_up_cacheMethod · 0.45
runMethod · 0.45

Calls 3

cache_keyMethod · 0.95
get_query_resultsFunction · 0.90
set_and_log_cacheFunction · 0.90

Tested by

no test coverage detected