4

Why can an attribute definition only be of types `{string, number, binary).

See Java SDK class com.amazonaws.services.dynamodbv2.model.AttributeDefinition or documentation.

What if I am trying to define a boolean attribute of type BOOL as mentioned here or here as a distinct type from a number (perhaps this is already the problem, maybe I shouldn't be trying to do this?)

I'm not clear why I cannot define the attribute type explicitly as BOOL. Is this because it's actually just a number 0/1? I would have assumed the above, had it not been for other documentation which talks about booleans as distinct type and annotations in the Java SDK like com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBConvertedBool or @DynamoDBTyped(DynamoDBMapperFieldModel.DynamoDBAttributeType.BOOL) which again seems to indicate that there is some type of distinct definition that can be used.

1 Answer 1

4

This only is the case for key attributes

Each primary key attribute must be a scalar (meaning that it can hold only a single value). The only data types allowed for primary key attributes are string, number, or binary. There are no such restrictions for other, non-key attributes.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.CoreComponents.html#HowItWorks.CoreComponents.PrimaryKey

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.