Error: Float types are not supported. Use decimal types instead.
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 number_value cannot be converted to string
- dynamodb cannot pickle '\_thread.lock' object
- sls dynamodb install not working
- dynamodb local shell not working
- cognitoidentitycredentials is not authorized to perform dynamodb describetable
- dynamodb does not accept empty set
- accessdeniedexception dynamodb
- is not authorized to perform dynamodb:* on resource
- Unable to start DynamoDB Local process
- failed to begin subsegment named 'amazondynamodbv2': segment cannot be found.
- DynamoDB error cannot find module build/Release/DTraceProviderBindings
- ValidationException: Invalid KeyConditionExpression: Attribute name is a reserved keyword;
- dynamodb autoscaling not fast enough
- DynamoDB - The Security Token Included In The Request Is Invalid
- DynamoDB Is Not Null
Tired of AWS Console? Try Dynobase.
First 7 days are. No credit card needed.
Product Features
DynamoDB Tools
DynamoDB Info
© 2023 Dynobase