dynobase-icon
Dynobase

Error: DynamoDB Is Not Null

Rafal Wilinski

Answered by Rafal Wilinski

Last updated: October 23rd, 2026

Solution

DynamoDB does not have a general SQL-style NOT NULL column constraint. Table primary keys must contain valid scalar values, while ordinary attributes may be absent or explicitly NULL. An optional secondary-index key can be omitted, but cannot be NULL when present.

For a native document-client filter that selects an existing non-null ordinary attribute, use:

const filter = {
  FilterExpression: "attribute_exists(#value) AND NOT attribute_type(#value, :nullType)",
  ExpressionAttributeNames: { "#value": "optionalValue" },
  ExpressionAttributeValues: { ":nullType": "NULL" },
};

Merge these fields into a valid Query or Scan request. attribute_exists alone also matches NULL. Empty strings and empty lists are values and pass this non-null check; validate them separately if your application forbids them.

For keys, supply the declared String, Number or Binary type. You cannot change a primary-key schema to allow NULL. Remove an optional GSI key attribute to exclude the item from that sparse index. Use ConditionExpression to enforce a rule atomically on a write rather than relying on a separate pre-read.

See missing and NULL values and AWS documentation.

Dynobase is a Professional GUI Client for DynamoDB

Start your 7-day free trial today

Product Features

Download
/
Pricing
/
Member Portal
/
Privacy
/
EULA
/
Twitter
© 2026 Dynobase
+
Still using AWS DynamoDB Console?
Try Dynobase to accelerate your DynamoDB workflow. Start your 7-day free trial today.