I have a simple table where primary key is ID and other attributes are name and balance. Now there are some rows where balance can be NULL. When I am fetching those attributes using Lambda function it cannot handle it. I want to handle these cases so that when a NULL attribute is detected it can show some message.
import json
import boto3
def lambda_handler(event, context):
client = boto3.resource("dynamodb")
table = client.Table("demoTable")
response = table.get_item(
Key = {
'ID': '9898'
}
)
item = str(response['Item']['balance'])
print(item)