Error: Float types are not supported. Use decimal types instead.
![Rafal Wilinski](https://pbs.twimg.com/profile_images/1390706809548197895/SVCKpLNE_400x400.png)
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 items page not authorized with read access
- dynamodb query is null
- DynamoDB attribute not empty
- dynamodb the parameter cannot be converted to a numeric value NaN
- dynamodb unable to parse base64 string
- DynamoDB failedbatch retry
- dynamodb the table does not have the specified index
- dynamodb put function not working
- failed to list tables not authorized dynamodb
- dynamodb unable to find storage information for property
- dynamodb user errors metric
- dynamodb property projection cannot be empty
- the dynamodb service does not have version
- DynamoDB Local Cannot Create Preexisting Table
- amazon dynamodb query parentparams is not defined
Better DynamoDB experience.
Try 7-day free trial. No credit card needed.
Product Features
DynamoDB Tools
DynamoDB Info
© 2024 Dynobase