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: Take the messages from the SQS queue and create partitions for new data in S3
  
  Args:
      event (dict): Lambda input event containing SQS messages. Each SQS message
          should contain one (or maybe more) S3 bucket notification message.
docstr_tok: ["Take","the","messages","from","the","SQS","queue","and","create","partitions","for","new","data","in","S3","Args",":","event","(","dict",")",":","Lambda","input","event","containing","SQS","messages",".","Each","SQS","message","should","contain","one","(","or","maybe","more",")","S3","bucket","notification","message","."]
code: def run(self, event):
      """Take the messages from the SQS queue and create partitions for new data in S3
  
      Args:
          event (dict): Lambda input event containing SQS messages. Each SQS message
              should contain one (or maybe more) S3 bucket notification message.
      """
      # Check that the database being used exists before running queries
      for sqs_rec in event["Records"]:
          LOGGER.debug(
              "Processing event with message ID '%s' and SentTimestamp %s",
              sqs_rec["messageId"],
              sqs_rec["attributes"]["SentTimestamp"],
          )
  
          body = json.loads(sqs_rec["body"])
          if body.get("Event") == "s3:TestEvent":
              LOGGER.debug("Skipping S3 bucket notification test event")
              continue
  
          for s3_rec in body["Records"]:
              if "s3" not in s3_rec:
                  LOGGER.info(
                      "Skipping non-s3 bucket notification message: %s",
                      s3_rec,
                  )
                  continue
  
              bucket_name = s3_rec["s3"]["bucket"]["name"]
  
              # Account for special characters in the S3 object key
              # Example: Usage of '=' in the key name
              object_key = urllib.parse.unquote_plus(
                  s3_rec["s3"]["object"]["key"]
              ).encode()
              if object_key.endswith(b"_$folder$"):
                  LOGGER.info(
                      "Skipping placeholder file notification with key: %s",
                      object_key,
                  )
                  continue
  
              LOGGER.debug(
                  "Received notification for object '%s' in bucket '%s'",
                  object_key,
                  bucket_name,
              )
  
              self._s3_buckets_and_keys[bucket_name].add(object_key)
      self._add_partitions()
  
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 5 for calling the AthenaPartitioner obj's underlying member method code with example usage: obj.run(event) without return types