Name 'Key' not defined Lambda function to access DynamoDB
You need to import the Key
function, like so:
from boto3.dynamodb.conditions import Key
Without importing it second time, u can address it like: boto3.dynamodb.conditions.Key
def getAssetExistance(asset):
dynamoTable = dynamo.Table('Assets')
response = dynamoTable.query(KeyConditionExpression= boto3.dynamodb.conditions.Key('userID').eq(asset))
return bool(response)