Error: Float types are not supported. Use decimal types instead.

Answered by Rafal Wilinski
What's Causing This Error
This error occurs with the AWS Python SDK when trying to persist an item containing an attribute with a floating-point number. For example, you may encounter this error in Python if you try to save an item with a float (30.51) value.
Solution - Here's How To Resolve It
You can convert the floating-point attribute to a string using Python's str()
function.
dynamodb = boto3.resource('dynamodb') table = dynamodb.Table('my-custom-table') // using str will help avoid the floating point error. item = {'name': 'item_name', 'floating_attribute': str(our_value)} table.put_item(Item=item)
Other Common DynamoDB Errors (with Solutions)
- Could not connect to the endpoint URL https:dynamodb.singapore.amazonaws.com
- boto3 dynamodb unable to locate credentials
- why is the GSI dynamodb not showing item count
- dynamodb cannot read properties of undefined
- dynamodb-admin command not found
- dynamodb unable to execute http request
- dynamodb global secondary index not working
- dynamodb could not load credentials from any providers
- DynamoDB Error All Attributes Must Be Indexed
- DynamoDB ConditionalCheckFailedException
- DynamoDB Error 413
- dynamodb property projection cannot be empty
- dynamodb docker unable to open database file
- dynamodb put item not working
- dynamodb cannot read property 's' of undefined
Login to the AWS Console less. Use Dynobase.
Start your 7-day free trial today
Product Features
DynamoDB Tools
DynamoDB Info
© 2025 Dynobase