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

Answered by Rafal Wilinski
Last updated: October 23rd, 2026
Solution
Float types are not supported. Use decimal types instead. comes from boto3's DynamoDB serializer. It accepts Decimal and integer numbers but rejects Python float values, including floats nested inside lists or dictionaries.
from decimal import Decimal
import boto3
import json
table = boto3.resource("dynamodb").Table("Products")
table.put_item(Item={"pk": "product-1", "price": Decimal("30.51")})
item = json.loads('{"pk":"product-2","price":30.51}', parse_float=Decimal)
table.put_item(Item=item)Parse the original decimal text when possible. Decimal(30.51) preserves the binary float approximation; Decimal(str(value)) is a practical conversion when a float already exists, but cannot recover precision previously lost. Inspect nested structures for remaining floats.
Converting a price to str merely to bypass the error stores a DynamoDB String and changes numeric comparisons and arithmetic. Use strings only when that is the intended model. Non-finite values such as infinity and NaN are not valid DynamoDB numbers.
See Python examples and AWS documentation.
Other Common DynamoDB Errors (with Solutions)
- DynamoDB Update Not Working
- DynamoDB local error spawn java ENOENT
- ProvisionedThroughputExceededException DynamoDB
- Conditional Update Error DynamoDB
- dynamodb put item not working
- DynamoDB Mapper Could Not Instantiate Class
- DynamoDB failedbatch retry
- Error retrieving DynamoDB table item validation exception
- DynamoDB no attribute schema defined
- error updating dynamodb table time to live
- dynamodb streams missing events
- dynamodb index does not exist
- localstack dynamodb not working
- dynamodb query is null
- dynamodb-admin not working
Dynobase is a Professional GUI Client for DynamoDB
Start your 7-day free trial today
Product Features
DynamoDB Tools
- SSH GUI Client
- Chat With Cloud
- MongoDB GUI Client
- AWS Cost Monitoring
- DynamoDB Query Builder
- DynamoDB Code Examples
- DynamoDB Node.js Queries
- DynamoDB JSON Converter
- DynamoDB UUID Generator
- DynamoDB Local Admin GUI
- DynamoDB Pricing Calculator
- DynamoDB Single-Table Design
- Best DynamoDB GUI Clients
- Dynobase vs DynoTable