class_docstr: Replicates records from a DynamoDB table to S3.
  
  It scans a DynamoDB table and writes the received records to a file
  on the local filesystem. It flushes the file to S3 once the file size
  exceeds the file size limit specified by the user.
  
  Users can also specify a filtering criteria using dynamodb_scan_kwargs
  to only replicate records that satisfy the criteria.
  
  .. seealso::
      For more information on how to use this operator, take a look at the guide:
      :ref:`howto/transfer:DynamoDBToS3Operator`
  
  :param dynamodb_table_name: Dynamodb table to replicate data from
  :param s3_bucket_name: S3 bucket to replicate data to
  :param file_size: Flush file to s3 if file size >= file_size
  :param dynamodb_scan_kwargs: kwargs pass to
      <https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html#DynamoDB.Table.scan>
  :param s3_key_prefix: Prefix of s3 object key
  :param process_func: How we transform a dynamodb item to bytes. By default, we dump the json
  :param export_time: Time in the past from which to export table data, counted in seconds from the start of
   the Unix epoch. The table export will be a snapshot of the table's state at this point in time.
  :param export_format: The format for the exported data. Valid values for ExportFormat are DYNAMODB_JSON
   or ION.
  :param check_interval: The amount of time in seconds to wait between attempts. Only if ``export_time`` is
      provided.
  :param max_attempts: The maximum number of attempts to be made. Only if ``export_time`` is provided.
class_docstr_tok: ["Replicates","records","from","a","DynamoDB","table","to","S3",".","It","scans","a","DynamoDB","table","and","writes","the","received","records","to","a","file","on","the","local","filesystem",".","It","flushes","the","file","to","S3","once","the","file","size","exceeds","the","file","size","limit","specified","by","the","user",".","Users","can","also","specify","a","filtering","criteria","using","dynamodb_scan_kwargs","to","only","replicate","records","that","satisfy","the","criteria",".","..","seealso",":",":","For","more","information","on","how","to","use","this","operator",",","take","a","look","at","the","guide",":",":","ref",":","`","howto\/transfer",":","DynamoDBToS3Operator","`",":","param","dynamodb_table_name",":","Dynamodb","table","to","replicate","data","from",":","param","s3_bucket_name",":","S3","bucket","to","replicate","data","to",":","param","file_size",":","Flush","file","to","s3","if","file","size",">","=","file_size",":","param","dynamodb_scan_kwargs",":","kwargs","pass","to","<","https",":","\/\/boto3.amazonaws.com\/v1\/documentation\/api\/latest\/reference\/services\/dynamodb.html","#","DynamoDB.Table.scan",">",":","param","s3_key_prefix",":","Prefix","of","s3","object","key",":","param","process_func",":","How","we","transform","a","dynamodb","item","to","bytes",".","By","default",",","we","dump","the","json",":","param","export_time",":","Time","in","the","past","from","which","to","export","table","data",",","counted","in","seconds","from","the","start","of","the","Unix","epoch",".","The","table","export","will","be","a","snapshot","of","the","table","'s","state","at","this","point","in","time",".",":","param","export_format",":","The","format","for","the","exported","data",".","Valid","values","for","ExportFormat","are","DYNAMODB_JSON","or","ION",".",":","param","check_interval",":","The","amount","of","time","in","seconds","to","wait","between","attempts",".","Only","if","``","export_time","``","is","provided",".",":","param","max_attempts",":","The","maximum","number","of","attempts","to","be","made",".","Only","if","``","export_time","``","is","provided","."]
code: def _scan_dynamodb_and_upload_to_s3(
      self, temp_file: IO, scan_kwargs: dict, table: Any
  ) -> IO:
      while True:
          response = table.scan(**scan_kwargs)
          items = response["Items"]
          for item in items:
              temp_file.write(self.process_func(item))
  
          if "LastEvaluatedKey" not in response:
              # no more items to scan
              break
  
          last_evaluated_key = response["LastEvaluatedKey"]
          scan_kwargs["ExclusiveStartKey"] = last_evaluated_key
  
          # Upload the file to S3 if reach file size limit
          if os.path.getsize(temp_file.name) >= self.file_size:
              _upload_file_to_s3(
                  temp_file,
                  self.s3_bucket_name,
                  self.s3_key_prefix,
                  self.dest_aws_conn_id,
              )
              temp_file.close()
  
              temp_file = NamedTemporaryFile()
      return temp_file
  
imports: from __future__ import annotations
  import json
  import os
  from copy import copy
  from datetime import datetime
  from decimal import Decimal
  from functools import cached_property
  from tempfile import NamedTemporaryFile
  from typing import IO, TYPE_CHECKING, Any, Callable, Sequence
  from uuid import uuid4
  from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook
  from airflow.providers.amazon.aws.hooks.dynamodb import DynamoDBHook
  from airflow.providers.amazon.aws.hooks.s3 import S3Hook
  from airflow.providers.amazon.aws.transfers.base import AwsToAwsBaseOperator
label_desc: Use image node_id 6 for calling the DynamoDBToS3Operator obj's underlying member method code with example usage: obj._scan_dynamodb_and_upload_to_s3(temp_file, scan_kwargs, table) and returns: temp_file