title: What causes 'The provided key element does not match the schema' error?
body: <p>Thanks a lot.</p>
  <p>I'm using glue for migrating one dynamodb table to another table in the same region.
  However I've got this error.</p>
  <blockquote>
  <p>An error occurred while calling o97.pyWriteDynamicFrame. The provided
  key element does not match the schema (Service: AmazonDynamoDBv2;
  Status Code: 400; Error Code: ValidationException; Request ID:
  O7T8OP9M14IGOQFL9HOJP; Proxy: null)</p>
  </blockquote>
  <p>The source dynamodb table items are simply like this.</p>
  <pre><code>{
    &quot;Item&quot;: {
      &quot;memNo&quot;: {
        &quot;S&quot;: &quot;b&quot;
      }
    }
  }
  {
    &quot;Item&quot;: {
      &quot;memNo&quot;: {
        &quot;S&quot;: &quot;a&quot;
      }
    }
  }
  {
    &quot;Item&quot;: {
      &quot;memNo&quot;: {
        &quot;S&quot;: &quot;cde&quot;
      }
    }
  }
  </code></pre>
  <p>And both source and target table have just one partition key.</p>
  <pre><code>memNo (String)
  </code></pre>
  <p>and I turned on PITR option for source table, and exported to S3 bucket.
  so the source data is now .gz file.</p>
  <p>And this is the Glue code</p>
  <pre><code>import sys
  from awsglue.transforms import *
  from awsglue.utils import getResolvedOptions
  from pyspark.context import SparkContext
  from awsglue.context import GlueContext
  from awsglue.job import Job
  
  args = getResolvedOptions(sys.argv, [&quot;JOB_NAME&quot;])
  sc = SparkContext()
  glueContext = GlueContext(sc)
  spark = glueContext.spark_session
  job = Job(glueContext)
  job.init(args[&quot;JOB_NAME&quot;], args)
  
  # Script generated for node Data Catalog table
  DataCatalogtable_node1 = glueContext.create_dynamic_frame.from_catalog(
      database=&quot;dynamotest&quot;,
      table_name=&quot;w5dllnzmzq7kdhj5oo4epg476a_json_gz&quot;,
      transformation_ctx=&quot;DataCatalogtable_node1&quot;,
  )
  
  # Script generated for node Apply Mapping
  ApplyMapping_node1644253291017 = ApplyMapping.apply(
      frame=DataCatalogtable_node1,
      mappings=[(&quot;item.memNo.S&quot;, &quot;string&quot;, &quot;memNo&quot;, &quot;string&quot;)],
      transformation_ctx=&quot;ApplyMapping_node1644253291017&quot;,
  )
  
  glueContext.write_dynamic_frame_from_options(
      frame=DataCatalogtable_node1,
      connection_type=&quot;dynamodb&quot;,
      connection_options={
          &quot;dynamodb.output.tableName&quot;: &quot;TargetTable&quot;
      }
  )
  
  job.commit()
  </code></pre>
  <p>Whenever I try, Glue job says 'The provided key element does not match the schema' error.</p>
  <p>How do I fix it?</p>