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)
- DynamoDB Internal Server Error
- dynamodb put item not working
- dynamodb unable to find storage information for property
- Error ValidationException: One or more parameter values were invalid: Type mismatch for key X expected: S actual: M
- Conditional Update Error DynamoDB
- DynamoDB Scan Not Working
- DynamoDB Error Message KeyError item is not JSON serializable
- DynamoDB Code Working In Node But Not SAM
- dynamodb docker unable to open database file
- DynamoDB Missing Authentication Token
- dynamodb ttl not deleting / erasing items
- comparison operator does not return all attributes dynamodb
- DynamoDB Failed To Compute Node presentation
- failed to list tables not authorized dynamodb
- dynamodb cannot read properties of undefined
Tired of AWS Console? Try Dynobase.
First 7 days are. No credit card needed.
Product Features
DynamoDB Tools
DynamoDB Info
© 2024 Dynobase