I have a DynamoDB Index storing a date in iso-8601 format, [i.e. '2017-03-17']. I'd like to query the Index for dates less than a certain date. [i.e datetime.now() - 30 days].
I believe this is support from looking at Amazon's API docs. I seem to be missing something with the boto3 syntax.
I am using the resource and not the client in boto3.
I know I can use epoch but would like to use the ISO format for readability.
Here is the test code I have.
import boto3
from boto3.dynamodb.conditions import Key, Attr
ddb = boto3.resource('dynamodb')
_table = ddb.Table('TableWithDateIndex')
response2 = _table.query(
IndexName='DeleteDate-index',
KeyConditionExpression=Key('IndexDate').lt('2017-04-17')
)
print response2['Items']
Fails with:
botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the Query operation: Query key condition not supported