'using "contains" for query key condition in dynamoDB

I am trying to query my dynamodb with contains comparison parameter, but it is not working

data= table.query(
    IndexName='farm_name-index',
    KeyConditionExpression = Key('user_name').eq(user_name)& contains(Key('farm_zone_id_time_stamp'),farm_zone_id_time_stamp)& Key('time_stamp').between(from_time,to_time) 
    )

and i am getting the following error :

name 'contains' is not defined: NameError
Traceback (most recent call last):
  File "/var/task/lambda_function.py", line 25, in lambda_handler
    KeyConditionExpression = Key('user_name').eq(user_name)& contains(Key('farm_zone_id_time_stamp'),farm_zone_id_time_stamp)& Key('time_stamp').between(from_time,to_time)
NameError: name 'contains' is not defined

can any one tell me the right way to doit ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source