class_docstr: A DoFn that extracts slice keys in batch.
class_docstr_tok: ["A","DoFn","that","extracts","slice","keys","in","batch","."]
code: def setup(self):
      def _GenerateQueries(
          schema: pa.Schema,
      ) -> List[sql_util.RecordBatchSQLSliceQuery]:
          result = []
          for sql in self._sqls:
              try:
                  result.append(
                      sql_util.RecordBatchSQLSliceQuery(sql, schema)
                  )
              except Exception as e:
                  raise RuntimeError(
                      f"Failed to parse sql:\n\n{sql}"
                  ) from e
          return result
  
      # A cache for compiled sql queries, keyed by record batch schemas.
      # This way the extractor can work with record batches of different schemas,
      # which is legit but uncommon.
      self._cached_queries = functools.lru_cache(maxsize=3)(
          _GenerateQueries
      )
  
imports: import copy
  import functools
  from typing import List, Mapping
  import apache_beam
  import pyarrow
  import tensorflow
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.extractors import extractor
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.slicer import slicer_lib
  from tensorflow_model_analysis.utils import util
  from tfx_bsl.arrow import sql_util
  from tfx_bsl.tfxio import tensor_to_arrow
label_desc: Use image node_id 2 for calling the ExtractSqlSliceKeyFn obj's underlying member method code with example usage: obj.setup() and returns: result