title: Query all data in DynamoDB without using primary partition key
body: <p>I am very new to DynamoDB. I want to query all data within certain time range.</p>
  
  <p>column = "timerange" is primary sort key  <br>
  column = "name"      is primary partition key.</p>
  
  <p>I want to get all data within 2 timerange.</p>
  
  <p>This is my query.   </p>
  
  <pre><code>from decimal import *
  from boto3.dynamodb.conditions import Key, Attr
  import boto3
  import time
  from datetime import datetime
  
  dynamo = boto3.resource('dynamodb')
  table = dynamo.Table('tablename')
  a = time.mktime(datetime.strptime('2020-03-26 14:29:10','%Y-%m-%d %H:%M:%S').timetuple())
  b = time.mktime(datetime.strptime('2020-03-26 14:30:10','%Y-%m-%d %H:%M:%S').timetuple())
  
  response = table.query(
      KeyConditionExpression =
          Key('timerange').between(Decimal(a), Decimal(b)))
  </code></pre>
  
  <p>Which gives me an error <code>ClientError: An error occurred (ValidationException) when calling the Query operation: Query condition missed key schema element:</code> After searching the internet I found out that you need to have primary partition key inside your query 
  so I tried the Contains method from <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Condition.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Condition.html</a></p>
  
  <pre><code>response = table.query(
      KeyConditionExpression =
          Key('name').contains('a', 'b') &amp;
          Key('timerange').between(Decimal(a), Decimal(b)))
  </code></pre>
  
  <p>Which I clearly do not understand fully. </p>
  
  <p>How can I get all data within given timerange [a,b]?</p>