Skip to content

How it works ​

ddb-data-check performs table schema checks and item-level comparisons. It does not call a write API.

Schema check ​

The command calls DescribeTable on source and target and checks the partition key name, optional sort key name, and each local secondary index name and sort key name. A mismatch is written as table_schema_diff, and item checking stops for that table.

Data comparison pipeline ​

check_mode selects the baseline. Source mode scans source; target mode scans target.

text
Scan the baseline endpoint
    ↓
Extract the primary key and full item
    ↓
GetItem from the peer endpoint
    ↓
Deserialize and compare fields
    ↓
Write the JSON difference report

The original primary-key AttributeValue from the Scan response is used directly for peer GetItem, preserving numeric key representations.

Item comparison ​

Both items are deserialized to map[string]interface{}. The command first normalizes numeric types and compares the maps. If they differ, it recursively sorts slices and compares again to handle unordered DynamoDB Sets.

Results include:

  • item_missing_in_peer: the peer endpoint has no item for the key.
  • item_diff: both endpoints have the item, but its fields differ.
  • item_error: GetItem, deserialization, or another read operation failed.
  • table_summary: compared, diff, missing, and error totals.

Direction and consistency boundary ​

check_mode = "source" does not detect target-only items. Run again with check_mode = "target" when they must also be checked.

Scan and GetItem do not share a snapshot timestamp. Application writes during the check can appear as temporary differences.

Released under the MIT License.