Error: 'dynamodb' object has no attribute 'table'

Answered by Rafal Wilinski
What's Causing This Error
This error occurs in the AWS Python SDK when obtaining a table resource using the DynamoDB "client" rather than the "resource."
import boto3 // error occurs when "boto3.client" is used dynamodb = boto3.client('dynamodb') table = dynamodb.Table('my-custom-table')
The snippet above uses the boto3.client('dynamodb')
that causes the error.
Solution - Here's How To Resolve It
Use the DynamoDB "resource" rather than the "client" to resolve the error.
import boto3 // no error with "boto3.resource" dynamodb = boto3.resource('dynamodb') table = dynamodb.Table('my-custom-table') // perform operations with the table as there is no error
Other Common DynamoDB Errors (with Solutions)
- ExpressionAttributeValues contains invalid value: One or more parameter values were invalid: An AttributeValue may not contain an empty string
- could not unmarshal the value dynamodb
- aws lambda dynamodb nodejs not working after few puts
- DynamoDB Auto Scaling Not Working
- dynamodb text contents could not be decoded
- DynamoDB string set cannot be empty
- dynamodb update fail if not exists
- dynamodb local could not load credentials from any providers
- dynamodb no range key value present
- dynamodb list_append if_not_exists not working
- dynamodb stream missing fields
- AWS DynamoDB CredentialsError: Missing credentials in config
- dynamodb does not support null values
- DynamoDB transaction error
- dynamodb request is missing authentication token
Login to the AWS Console less. Use Dynobase.
Try 7-day free trial. No credit card needed.
Product Features
DynamoDB Tools
DynamoDB Info
© 2025 Dynobase