class_docstr: Handle polling an SQS queue and running Athena queries for updating tables
class_docstr_tok: ["Handle","polling","an","SQS","queue","and","running","Athena","queries","for","updating","tables"]
docstr: Execute a Hive Add Partition command for the given Athena tables and partitions
  
  Returns:
      (bool): If the repair was successful for not
docstr_tok: ["Execute","a","Hive","Add","Partition","command","for","the","given","Athena","tables","and","partitions","Returns",":","(","bool",")",":","If","the","repair","was","successful","for","not"]
code: def _add_partitions(self):
      """Execute a Hive Add Partition command for the given Athena tables and partitions
  
      Returns:
          (bool): If the repair was successful for not
      """
      partitions = self._get_partitions_from_keys()
      if not partitions:
          LOGGER.warning("No partitions to add")
          return False
  
      for athena_table in partitions:
          partition_statement = " ".join(
              [
                  "PARTITION {0} LOCATION {1}".format(
                      partition, location
                  )
                  for partition, location in partitions[
                      athena_table
                  ].items()
              ]
          )
          query = (
              "ALTER TABLE {athena_table} "
              "ADD IF NOT EXISTS {partition_statement};".format(
                  athena_table=athena_table,
                  partition_statement=partition_statement,
              )
          )
  
          success = self._ATHENA_CLIENT.run_query(query=query)
          if not success:
              raise AthenaPartitionerError(
                  "The add hive partition query has failed:\n{}".format(
                      query
                  )
              )
  
          LOGGER.info(
              "Successfully added the following partitions:\n%s",
              json.dumps({athena_table: partitions[athena_table]}),
          )
      return True
  
imports: from collections import defaultdict
  import json
  import posixpath
  import re
  import urllib.request
  import urllib.parse
  import urllib.error
  from streamalert.shared.utils import get_database_name, get_data_file_format
  from streamalert.shared.athena import AthenaClient
  from streamalert.shared.config import athena_partition_buckets, load_config
  from streamalert.shared.exceptions import ConfigError
  from streamalert.shared.logger import get_logger
label_desc: Use image node_id 4 for calling the AthenaPartitioner obj's underlying member method code with example usage: obj._add_partitions() and returns: True, False