code: def generate_data_table_schema(config, table, schema_override=None):
      """Generate the schema for data table in terraform
  
      Args:
          config (CLIConfig): Loaded StreamAlert config
          table (string): The name of data table
  
      Returns:
          athena_schema (dict): Equivalent Athena schema used for generating create table statement
      """
      enabled_logs = FirehoseClient.load_enabled_log_sources(
          config["global"]["infrastructure"]["firehose"], config["logs"]
      )
  
      # Convert special characters in schema name to underscores
      sanitized_table_name = FirehoseClient.sanitized_value(table)
  
      # Check that the log type is enabled via Firehose
      if sanitized_table_name not in enabled_logs:
          LOGGER.error(
              "Table name %s missing from configuration or "
              "is not enabled.",
              sanitized_table_name,
          )
          return None
  
      log_info = config["logs"][enabled_logs.get(sanitized_table_name)]
  
      schema = dict(log_info["schema"])
      sanitized_schema = FirehoseClient.sanitize_keys(schema)
  
      athena_schema = logs_schema_to_athena_schema(
          sanitized_schema, False
      )
  
      # Add envelope keys to Athena Schema
      configuration_options = log_info.get("configuration")
      if configuration_options:
          envelope_keys = configuration_options.get("envelope_keys")
          if envelope_keys:
              sanitized_envelope_key_schema = (
                  FirehoseClient.sanitize_keys(envelope_keys)
              )
              # Note: this key is wrapped in backticks to be Hive compliant
              athena_schema[
                  "streamalert:envelope_keys"
              ] = logs_schema_to_athena_schema(
                  sanitized_envelope_key_schema, False
              )
  
      # Handle Schema overrides
      #   This is useful when an Athena schema needs to differ from the normal log schema
      if schema_override:
          for override in schema_override:
              column_name, column_type = override.split("=")
              # Columns are escaped to avoid Hive issues with special characters
              column_name = "{}".format(column_name)
              if column_name in athena_schema:
                  athena_schema[column_name] = column_type
                  LOGGER.info(
                      "Applied schema override: %s:%s",
                      column_name,
                      column_type,
                  )
              else:
                  LOGGER.error(
                      "Schema override column %s not found in Athena Schema, skipping",
                      column_name,
                  )
  
      return format_schema_tf(athena_schema)
  
file_path: streamalert/streamalert_cli/athena/helpers.py
imports: import re
  from streamalert.shared.artifact_extractor import Artifact
  from streamalert.shared.firehose import FirehoseClient
  from streamalert.shared.logger import get_logger
  from streamalert.shared.alert import Alert
  from streamalert_cli.helpers import record_to_schema
label_desc: Use image node_id 6 for calling a global function with example usage: generate_data_table_schema(config, table, schema_override) and returns: format_schema_tf, None