I am attempting to print the value of "age" in stored in the info attribute within a dynamodb. Below is a sample data set along with the code I am using. I recieve an error: "KeyERROR: 'info.age'. I have tried several different variations and all unsuccessful.
Here is code where I query the database and try to print output:
response = table.query(
KeyConditionExpression=Key('bourbon_id').eq("Four Roses") )
for i in response['Items']:
print(i['bourbon_id'], ":", i['source_id'], ":", i['info.age'])
Here is example data:
"bourbon_id": "Four Roses",
"source_id": "Liquor Barn",
"info":{
"age": 11,
"proof": 124,
"open": 1,
"closed": 0,
"barrled": "June 12 2002",
"bottled": "December 15 2013",
"description": "OESK"
If I remove the age, it prints out all items within info.. How can I get just the value of age to print?
for i in response['Items']:
print(i['bourbon_id'], ":", i['source_id'], ":", i['info'])