docstr: Take a query context cache key and return payload
  data response for the given query.
  ---
  get:
    summary: Return payload data response for the given query
    description: >-
      Takes a query context cache key and returns payload data
      response for the given query.
    parameters:
    - in: path
      schema:
        type: string
      name: cache_key
    responses:
      200:
        description: Query result
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ChartDataResponseSchema"
      400:
        $ref: '#/components/responses/400'
      401:
        $ref: '#/components/responses/401'
      404:
        $ref: '#/components/responses/404'
      422:
        $ref: '#/components/responses/422'
      500:
        $ref: '#/components/responses/500'
docstr_tok: ["Take","a","query","context","cache","key","and","return","payload","data","response","for","the","given","query",".","--","-","get",":","summary",":","Return","payload","data","response","for","the","given","query","description",":",">","-","Takes","a","query","context","cache","key","and","returns","payload","data","response","for","the","given","query",".","parameters",":","-","in",":","path","schema",":","type",":","string","name",":","cache_key","responses",":","200",":","description",":","Query","result","content",":","application\/json",":","schema",":","$","ref",":","``","#","\/components\/schemas\/ChartDataResponseSchema","''","400",":","$","ref",":","'","#","\/components\/responses\/400'","401",":","$","ref",":","'","#","\/components\/responses\/401'","404",":","$","ref",":","'","#","\/components\/responses\/404'","422",":","$","ref",":","'","#","\/components\/responses\/422'","500",":","$","ref",":","'","#","\/components\/responses\/500","'"]
code: def data_from_cache(self, cache_key: str) -> Response:
      """
      Take a query context cache key and return payload
      data response for the given query.
      ---
      get:
        summary: Return payload data response for the given query
        description: >-
          Takes a query context cache key and returns payload data
          response for the given query.
        parameters:
        - in: path
          schema:
            type: string
          name: cache_key
        responses:
          200:
            description: Query result
            content:
              application/json:
                schema:
                  $ref: "#/components/schemas/ChartDataResponseSchema"
          400:
            $ref: '#/components/responses/400'
          401:
            $ref: '#/components/responses/401'
          404:
            $ref: '#/components/responses/404'
          422:
            $ref: '#/components/responses/422'
          500:
            $ref: '#/components/responses/500'
      """
      try:
          cached_data = self._load_query_context_form_from_cache(
              cache_key
          )
          # Set form_data in Flask Global as it is used as a fallback
          # for async queries with jinja context
          setattr(g, "form_data", cached_data)
          query_context = self._create_query_context_from_form(
              cached_data
          )
          command = ChartDataCommand(query_context)
          command.validate()
      except ChartDataCacheLoadError:
          return self.response_404()
      except ValidationError as error:
          return self.response_400(
              message=_(
                  "Request is incorrect: %(error)s",
                  error=error.messages,
              )
          )
  
      return self._get_data_response(command, True)
  
imports: from __future__ import annotations
  import contextlib
  import json
  import logging
  from typing import Any, TYPE_CHECKING
  import simplejson
  from flask import current_app, g, make_response, request, Response
  from flask_appbuilder.api import expose, protect
  from flask_babel import gettext
  from marshmallow import ValidationError
  from superset import is_feature_enabled, security_manager
  from superset.async_events.async_query_manager import AsyncQueryTokenException
  from superset.charts.api import ChartRestApi
  from superset.charts.data.query_context_cache_loader import QueryContextCacheLoader
  from superset.charts.post_processing import apply_post_process
  from superset.charts.schemas import ChartDataQueryContextSchema
  from superset.commands.chart.data.create_async_job_command import CreateAsyncChartDataJobCommand
  from superset.commands.chart.data.get_data_command import ChartDataCommand
  from superset.commands.chart.exceptions import ChartDataCacheLoadError, ChartDataQueryFailedError
  from superset.common.chart_data import ChartDataResultFormat, ChartDataResultType
  from superset.connectors.sqla.models import BaseDatasource
  from superset.daos.exceptions import DatasourceNotFound
  from superset.exceptions import QueryObjectValidationError
  from superset.extensions import event_logger
  from superset.models.sql_lab import Query
  from superset.utils.core import create_zip, get_user_id, json_int_dttm_ser
  from superset.views.base import CsvResponse, generate_download_headers, XlsxResponse
  from superset.views.base_api import statsd_metrics
label_desc: Use image node_id 3 for calling the ChartDataRestApi obj's underlying member method code with example usage: obj.data_from_cache(cache_key) and returns: self, self, self