Skip to content

ParamValidationError when using DynamoDB paginator #2300

@usegev

Description

@usegev

I create a DynamoDB paginator like this:

    paginator = client.get_paginator('query')
    page_iterator = paginator.paginate(
        TableName=TABLE_NAME,
        IndexName=INDEX_NAME,
        KeyConditionExpression=Key('X').eq(x) & Key('Y').lte(y)
    )
    for page in page_iterator:
        print (page['Items'])
    return

When I run it, I receive the following error:

Exception has occurred: ParamValidationError
Parameter validation failed:
Invalid type for parameter KeyConditionExpression, value: <boto3.dynamodb.conditions.And object at 0x111524110>, type: <class 'boto3.dynamodb.conditions.And'>, valid types: <class 'str'>

The exact same KeyConditionExpression works when I query the table directly:

    result = table.query(
        IndexName=INDEX_NAME,
        KeyConditionExpression=Key('X').eq(x) & Key('Y').lte(y)
    )

BTW: Documentation says that KeyConditionExpression should be a string and not some condition built this way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationThis is a problem with documentation.dynamodbp2This is a standard priority issuepagination

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions