boto3 query using KeyConditionExpression
<p>I'm having trouble understanding why below query on a DynamoDB table doesn't work:</p>

<pre><code>dict_table.query(KeyConditionExpression='norm = :cihan', ExpressionAttributeValues={':cihan': {'S': 'cihan'}})
</code></pre>

<p>and throws this error: </p>

<p><code>ClientError: An error occurred (ValidationException) when calling the Query operation: One or more parameter values were invalid: Condition parameter type does not match schema type</code></p>

<p>while the following works:</p>

<pre><code>dict_table.query(KeyConditionExpression=Key('norm').eq('cihan'))
</code></pre>

<p><code>norm</code> is a field with type string. I'm using boto3 v 1.4.0 and <a href="http://boto3.readthedocs.io/en/latest/reference/services/dynamodb.html#DynamoDB.Client.query" rel="nofollow">following the docs</a>:</p>

<pre><code>In [43]: boto3.__version__
Out[43]: '1.4.0'
</code></pre>

<p>Can anyone see what's the error in the first query?</p>

<p>Bonus question: What's with all the tokens and the need to replace them all the time? Why can't I just say <code>dict_table.query(KeyConditionExpression='norm = cihan')</code></p>

<p>Please change the ExpressionAttributeValues as mentioned below. </p>

<pre><code>ExpressionAttributeValues={':cihan': 'cihan'}
</code></pre>

python amazon-web-services amazon-dynamodb boto3